For a project that uses the CLI, you will usually use ng serve. In other cases, you can use npm start. Here is a detailed explanation:
ng serve
It will serve the Angular CLI-oriented project, i.e. a project created using the Angular CLI, especially using:
ng new app-name
So, if you created a project using the CLI, you probably want to use ng serve
the beginning of the evening
This can be used in the case of a project that does not support the Angular CLI (or it can simply be used to run "ng serve" for a project that knows the Angular CLI)
As the other answers say, this is an npm command that will run the npm command from package.json with the identifier "start", and it should not just run "ng serve". In package.json, there might be something like the following:
"scripts": { "build:watch": "tsc -p src/ -w", "serve": "lite-server -c=bs-config.json", "start": "concurrently \"npm run build:watch\" \"npm run serve\"" ... }, "devDependencies": { "concurrently": "^3.2.0", "lite-server": "^2.2.2",
In this case, npm start will execute the following commands:
concurrently "npm run build:watch" "npm run serve"
This will simultaneously launch the TypeScript compiler (tracking code changes) and start the Node lite server (which uses BrowserSync)
Chris Halcrow Dec 07 '17 at 1:13 2017-12-07 01:13
source share