NPM Cheatsheet

Manthan Ankolekar - Jul 15 '22 - - Dev Community

NPM Installation

npm install -g npm
Enter fullscreen mode Exit fullscreen mode

Checking your version of npm and Node.js

node -v
npm -v
Enter fullscreen mode Exit fullscreen mode

List globally installed packages

npm list -g --depth=0
Enter fullscreen mode Exit fullscreen mode

Uninstall global package

npm -g uninstall <name>
Enter fullscreen mode Exit fullscreen mode

Upgrade npm on Windows

npm-windows-upgrade
Enter fullscreen mode Exit fullscreen mode

Update global packages

To see which packages need updating, use:

npm outdated -g --depth=0
Enter fullscreen mode Exit fullscreen mode

To update global packages individually you can use:

npm update -g <package> <package> <package>
Enter fullscreen mode Exit fullscreen mode

list available scripts to run

npm run
Enter fullscreen mode Exit fullscreen mode

Update npm

npm install -g npm@latest

// using windows? Then use
npm-windows-upgrade
Enter fullscreen mode Exit fullscreen mode

Installed version

npm list // for local packages
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .