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?
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'?
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",....... }
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).