Search code examples
angulardeploymentserverproduction-environment

Error while trying to deploy the angular app in a azure vm:


I have developed an angular app in my local machine. I am trying to deploy my angular app in a vm. I have install node and npm in the server. I have followed a tutorial - https://coursetro.com/posts/code/112/Angular-5-Deployment---Deploy-your-Angular-App

I have created the dist folder using

ng build --prod

Then transferred the folder produced in dist to the server under a folder test.

I ran the command

ng build --prod --base-href "/test/".

But this gives an error

The build command requires to be run in an Angular project, but a project definition could not be found.

Where am I going wrong? Is the location where I am trying to build is correct?


Solution

  • Running ng build twice is wrong. Run it once, take the dist output and deploy it to a web server like nginx. Installing npm and node on your server is also not needed, unless you have a node backend.