Angular-cli, node, npm most used commands

Angular-cli, node, npm most used commands

Below is a summary of the most used commands, specially when starting up or debugging an angular project tested on node server.

Note that to execute the commands below, you need to install node first.

// check node and npm versions
node --version
npm --version

// install the latest angular cli
npm install -g @angular/cli@latest

//install angular cli in dev dependencies
npm install --save-dev @angular/cli@latest

// install dependencies in package.json
npm install

// install node-sass for processing scss
npm install -g node-sass

// install specific version of dependency, for example typescript
npm install --save-dev typescript@2.6.2

// analyze available updated dependencies

// update package.json (change version in file) and dependencies
ncu -u

// update the local libraries
npm update

// check angular/cli version
ng --version

// clean the cache
npm cache clean --force

// verify the cache
npm cache verify

// remove unused dependencies
npm prune

// uninstall angular cli
npm uninstall -g @angular/cli

// remove node_modules and dist folder
rm -rf node_modules dist

// build the project
ng build --prod --aot=false


  • Node and npm can be uninstalled in windows control panel.
  • Some commands are not available anymore in newer version of node like ncu. Replaced by npm update.

Leave a Reply