npm commands you may not know, but useful!!!

0xkoji - Jun 13 '19 - - Dev Community

npm home packageName

This command open package's home page.

$ npm home express
Enter fullscreen mode Exit fullscreen mode

npm ls --depth 0

List packages you installed

$ npm ls --depth 0
Enter fullscreen mode Exit fullscreen mode

npm prune

This command will remove packages which are not in package.json, so this will be helpful to keep your project clean.

$ npm prune
Enter fullscreen mode Exit fullscreen mode

npm outdated

This command checks the latest version of packages you installed

$ npm outdated

styled-components             4.2.0    4.3.1    4.3.1  project_name
stylelint                    10.0.1   10.1.0   10.1.0  project_name
three                       0.104.0  0.104.0  0.105.2  project_name
ts-loader                     5.4.5    5.4.5    6.0.2  project_name
Enter fullscreen mode Exit fullscreen mode

Got great suggestion from M. Langhard a.k.a @riscie
n
https://github.com/tjunnone/npm-check-updates

We can check outdated packages one word and update with an option which is pretty easy.

$ ncu

$ ncu -u 
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .