George Edwards George Edwards - 1 month ago 14x
Node.js Question

Static assets not serving on Heroku but do locally?

I have a nodeJS + expressJS + Angular2-RC.5 based site which works fine on my local Windows 10 machine. However, when I try to deploy (here's the log) to Heroku and access the site, the front end console (Chrome) throws the following error and the site doesn't load. It seems there is some issue with RXjs not being served on Heroku?

zone.js:101 GET 404 (Not Found)

enter image description here

contains this:

(function(global) {
// map tells the System loader where to look for things
var map = {
'app': '/app', // 'dist',
'@angular': '/node_modules/@angular',
'angular2-in-memory-web-api': '/node_modules/angular2-in-memory-web-api',
'rxjs': '/node_modules/rxjs'
// packages tells the System loader how to load when no filename and/or no extension
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' },


and my

<script src="/node_modules/core-js/client/shim.min.js"></script>
<script src="/node_modules/zone.js/dist/zone.js"></script>
<script src="/node_modules/reflect-metadata/Reflect.js"></script>
<script src="/node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="/config/systemjs.config.js"></script>
System.import('app').catch(function(err){ console.error(err); });
<base href="/">

So if I run the project locally,
shows the js source.
However, if I push the project to Heroku, with this build log, that version returns a 404 on


If I clone my repo to a new location on my machine, cd to the project root, run
npm i
, then
git submodule update --init" then
node ./bin/www` then the project runs fine on localhost. I presume this means that all the info in the repo is sufficient to get the project functional. So my suspicion is still that it is something to do with the way my static asses are being served on Heroku vs. my local machine.


Well the server is probably linux based and there the file/folder names are case sensitive. It's Rx.js not RX.js. So you've got a wrong import somewhere