Vladimir Despotovic
Vladimir Despotovic

Reputation: 3498

Angular 2 - building "dist" for production using "npm", and not "ng build -prod"

I have a project that I am building and running with npm start instead of ng serve. I am an angular 2 beginner, so I don't know how to build this project for production, in order to have the dist/ folder with pure javascript/html/css in it. For ng init - created angular 2 apps, if I use ng command, I can just do ng build --prod when work is done and the dist folder is created. If I use ng build --prod on this project, angular is offering me to overwrite some of my files (app.module.ts, app.component.ts, etc....) which I don't want overwritten. There are routing things inside and I don't want to change them. How can I have the production version of this app (ie. the dist/ folder) without using the ng build --prod command? Angular-cli version is:

angular-cli: 1.0.0-beta.28.3

Upvotes: 4

Views: 6076

Answers (2)

Ploppy
Ploppy

Reputation: 15353

Please follow these instructions to update your CLI to the latest version:

https://github.com/angular/angular-cli#updating-angular-cli

Upvotes: 0

El houcine bougarfaoui
El houcine bougarfaoui

Reputation: 37373

I think you should use @angular/cli instead of angular-cli :

npm install -g @angular/cli

when I use ng build --prod there is no such a problem.

Upvotes: 2

Related Questions