p:: Node f:: yarn, pnpm

  • npm
  • Default package manager bundled with Node
  • Also the name of the public registry at npmjs.com

Common Commands

CommandDescription
npm installInstall all dependencies from package.json
npm install <pkg>Install a package and save to dependencies
npm install -D <pkg>Install as devDependency
npm run <script>Run a script defined in package.json
npm updateUpdate packages to latest compatible versions
npm publishPublish a package to the registry

Alternatives

  • yarn — faster installs, workspaces
  • pnpm — disk-efficient, hard links
  • Bun — all-in-one runtime with built-in package manager

Version Management

  • nvm — switch Node (and npm) versions
  • volta — pin Node/npm versions per project