Can't find node_modules after deployment Can't find node_modules after deployment typescript typescript

Can't find node_modules after deployment


I have not used SystemJS, but your bounty has enticed me to try answering anyway, since it looks like you still need an answer. :)

After glancing through some SystemJS docs, it looks like your index.html needs to be different for development vs production use. This is what the docs show for development:

<script src="systemjs/dist/system.js"></script><script>  SystemJS.import('/js/main.js');</script>

And this is what they show for production (notice the first line has a different src path):

<script src="systemjs/dist/system-production.js"></script><script>  SystemJS.import('/js/main.js');</script>

More importantly, take note that node_modules is not referenced in either case, nor should it be. If you have your code and configuration set up correctly, SystemJS (like other build tools) will package everything you need without any additional <script> tags. Instead, you should import your shims (and similar) from within your code somewhere. For example, in their Webpack guide (Webpack is a another build tool filling a similar role to SystemJS) the Angular team shows a polyfills.ts file that imports their shims, then they include the polyfills file into the build within their webpack configuration.

I'm sorry I can't offer more specific advice about SystemJS in particular, but hopefully this answer is enough to point you in the right direction.


You either have to deploy node_modules as a part of your package or have a script run npm install for you to get the packages from your package.json

To get the packages in your package.json file do npm install --save package-you-want-to-install

Then you can have your startup script install from the package json by trying the script on this link https://github.com/woloski/nodeonazure-blog/blob/master/articles/startup-task-to-run-npm-in-azure.markdown


One thing you could do is install the packages needed on Azure server via Kudu dashboard.

  1. Go to https://yoursitename.scm.azurewebsites.net
  2. Then Debug console -> CMD
  3. Go to home\site\wwwroot directory
  4. Type npm install

This will install the needed packages for the Angular 2 app to run on Azure server.