Node.js
npm
npm package manager commands for Node.js dependency management.
33 commands
Windows
MacOS
Linux
#javascript
#package-manager
#Popular
Package Management
Install all dependencies from package.json
npm install
Install a package as dependency
npm install <package>
Install as dev dependency
npm install -D <package>
Install a package globally
npm install -g <package>
Remove a package
npm uninstall <package>
Update all packages to latest allowed version
npm update
Check for outdated packages
npm outdated
Scripts & Running
Run the start script
npm start
Run the test script
npm test
Run a custom script from package.json
npm run <script>
List all available scripts
npm run
Execute a package binary without installing
npx <package>
Run a command from a local package
npm exec -- <cmd>
Publishing
Initialize a new package.json
npm init
Initialize with default values
npm init -y
Log in to the npm registry
npm login
Publish a package to the registry
npm publish
Bump the patch version number
npm version patch
Bump the minor version number
npm version minor
Create a tarball from a package
npm pack
Configuration
Show all config settings
npm config list
Set a config value
npm config set <key> <value>
Get a config value
npm config get <key>
Remove a config entry
npm config delete <key>
Clear the npm cache
npm cache clean --force
Auditing
Run a security audit on dependencies
npm audit
Automatically fix vulnerabilities
npm audit fix
Fix vulnerabilities with breaking changes
npm audit fix --force
List installed packages as tree
npm ls
List only top-level packages
npm ls --depth=0
Quick Commands
Install all dependencies from package.json
npm install
Run a custom script defined in package.json
npm run <script>
Run a security audit on installed dependencies
npm audit