What does npm do?

the Node.js package manager.

▸ Explain your own npm command →

npm examples, explained

$ npm install -D typescript

  • npmthe Node.js package manager
  • installinstall dependencies (or a named package)
  • -Dsave to devDependencies
  • typescriptan argument passed to the command

$ npm run build

  • npmthe Node.js package manager
  • runrun a script defined in package.json
  • buildan argument passed to the command

$ npm ci --omit=dev

  • npmthe Node.js package manager
  • ciclean install exactly from the lockfile
  • --omit=devexclude a dependency type from install (e.g. dev)

npm subcommands

install — install dependencies (or a named package)i — install dependencies (short for install)run — run a script defined in package.jsontest — run the project's test scriptstart — run the project's start scriptpublish — publish the package to the registryinit — create a package.jsonupdate — update packages to newer allowed versionsuninstall — remove a packageci — clean install exactly from the lockfileexec — run a package's binary

npm flags & options

-goperate globally, not on the local project
-Dsave to devDependencies
-Ssave to dependencies (default)
--save-devsave to devDependencies
--savesave to dependencies
--globaloperate globally
--productionskip devDependencies
--omitexclude a dependency type from install (e.g. dev)
--includeforce-include a dependency type
--forceoverwrite conflicts and bypass some checks
--legacy-peer-depsignore peer-dependency conflicts (npm v7+ behavior)
--workspacerun the command for this workspace only

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.