npm commands

How to check the dependencies and it’s current version ?

npm outdated command will be helpful to know the list of dependencies in your project with the current version you are using, required version for your other dependencies and also the latest available version.

npm outdated

npm outdated output:

How to clear npm cache ?

npm cache clean

clear npm cache forcefully:

npm cache clean --force

What is the command to run Angular 9 Universal with Express server in local ?

These are the commands needs to be run,

npm install
npm run build
npm run build:ssr
npm run serve:ssr

In Single Line Command in windows cmd,

npm install && npm run build && npm run build:ssr && npm run serve:ssr

How to check or identify the unused dependencies in Angular projects ?

depcheck was the fantastic package to check the unused dependencies, unused dev dependencies and missing dependencies.

npm install -g depcheck

If you do not like to install depcheck just to check this, then you can install npx then run the below command to check the same.

npm install -g npx
npx depcheck

depcheck provides the output like this, [personally I felt, that it is not properly checking the css frameworks like bootstrap whether it is used or not. in my project I have used bootstrap framework, but depcheck has reported that I have not used that in my project ]. So use with little care on this side note.

Leave a Reply