I have a little question about angular-cli.
Is it true that when I run ng serve I use the global installed angular-cli and when I run npm start the local one?
I have a little question about angular-cli.
Is it true that when I run ng serve I use the global installed angular-cli and when I run npm start the local one?
Command will decide by package.json
. ng serve / npm start is used based on package.json
can change form there. if ng serve
is not working can use npm start
to run server.
ng server :
"scripts": { "ng": "ng", "start": "ng serve", "test": "ng test",....... }
When you run the npm start
internally it will call whatever command is written inside the start in the package.json
.
"scripts": {
"start": "ng serve"
}
it will run the ng serve
For more details, check When to use 'npm start' and when to use 'ng serve'?
Yes it is true.
Let's say your global Angular CLI version is 2 and you just cloned and installed a project from github that is created with Angular CLI version 1. If you run ng serve
it will execute using version 2 (which is your global cli), if you run npm run start
it will use the script in node_modules/.bin folder (which is local to your project and which is the right one for the job).
Yes. It is true. ng serve runs the app on angular global cli on the current version of the installed angular version while npm run start runs it on the version of that particular angular application cloned version from the node-module.