npm & Yarn
Package manager commands for Node.js
DevOps
Project Setup
npm initCreate package.json
npm init -yCreate with defaults
yarn initCreate with Yarn
Install Packages
npm installInstall all dependencies
npm install <pkg>Install package
npm install -D <pkg>Install as devDependency
npm install -g <pkg>Install globally
yarn add <pkg>Yarn install package
yarn add -D <pkg>Yarn devDependency
Remove & Update
npm uninstall <pkg>Remove package
npm updateUpdate all packages
npm update <pkg>Update specific package
npm outdatedCheck outdated packages
yarn remove <pkg>Yarn remove
yarn upgradeYarn update all
Scripts & Running
npm run <script>Run script from package.json
npm startRun start script
npm testRun test script
npm run buildRun build script
npx <cmd>Run package without install
Info & Management
npm listList installed packages
npm list -gList global packages
npm info <pkg>Package information
npm cache clean --forceClear cache
npm auditSecurity audit
npm audit fixFix vulnerabilities