npm flags & options
-g, --global
Install or operate on packages globally instead of locally.
npm install -g typescript
npm ls -g --depth=0
--save-dev, -D
Save as a development dependency in package.json.
npm install --save-dev jest
--production
Install only production dependencies (skip devDependencies).
npm install --production
npm ci --production
--legacy-peer-deps
Bypass peer dependency conflicts during install.
npm install --legacy-peer-deps
-y, --yes
Accept all defaults without prompting during npm init.
npm init -y
--registry
Set the npm registry URL.
npm install --registry=https://registry.npmmirror.com
--dry-run
Show what would happen without actually doing it.
npm publish --dry-run
npm pack --dry-run
--force
Force operations that would otherwise fail.
npm install --force
npm cache clean --force
--workspace, -w
Run a command in the context of a specific workspace (monorepo).
npm install lodash -w packages/utils
npm run build -w packages/app
--include, --omit
Control which dependency types to install.
npm install --omit=dev
npm install --include=optional
--prefix
Set the folder where packages are installed.
npm install --prefix ./deploy express