How to run an angular/node.js site in IIS 10 on Windows Server 2016

Please visit this site here:

www.develop.riskalive.com

It’s an angular 2 site running on a linux machine with node.js. We are trying to transfer the site over to a Windows Server 2016 machine. I’m having trouble.

I copied all the source code onto the Windows Server as-is. I’m able to run the site as-is from the server but it crashes when looking for certain resources:

I started with common.js. I did a search on the server and compared it with a search on my development machine (where the source code is sitting). The two searches show that common.js exists in exactly the same places on both the server and my machine (and there’s more than one).

The site works on my development machine. Why would it be able to find the resources on my machine but not on the server?

Do those files exist on the server?
I take it you are building on linux machine and just deploying the distribution directory to the windows one?

No, I’m copying the source code from my dev machine onto the Windows server as-is. Though I did try copying just the contents of the dist folder but got similar results.

I new to deploying Angular 2 applications. I don’t know what needs to be deployed.

For your remote server you should build for prod on your local environment. This will create a dist directory. The dist directory will contain all the compiled assets. Upload the dist directory to your server and configure the dist directory as the http site root.

Thanks for clarifying that ZooKeeper.

I’m not sure how to produce a build in an Angular 2 application. I work in Visual Studio and I’m used to .NET application. Building usually builds a .dll or .exe. But I’m not sure how this is done in Angular.

I know that when we run locally, we have to run “npm run watch” and “npm start” in a command prompt and that runs the node server on port 8888. Would this also build the application in dist? How would you configure this for production or test?

Visit the angular cli documentation for different build options.

Production build is a little stricter than dev build. So cross your fingers the project builds without any errors otherwise you might need to do some bug fixing before you can build for prod.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.