install
npm ci
Performs a clean, deterministic install straight from package-lock.json (or npm-shrinkwrap.json) intended for CI environments. It deletes any existing node_modules and refuses to run if package.json and the lockfile are out of sync.
npm ci [--omit=dev|optional|peer] [--ignore-scripts] Common flags
| Flag | Purpose |
|---|---|
| --omit=dev | Skip devDependencies (production install) |
| --omit=optional | Skip optionalDependencies |
| --ignore-scripts | Do not run pre/post install lifecycle scripts |
| --audit=false | Disable the automatic audit step |
| --prefer-offline | Use cache when possible; hit the network only on miss |
Examples
npm ci Reproducible install for CI pipelines
npm ci --omit=dev Production install without devDependencies
npm ci --ignore-scripts Safer, faster install skipping lifecycle scripts
Gotcha
`npm ci` DELETES node_modules before installing and will NEVER modify package.json or package-lock.json — if the lockfile is missing or drifted it exits with an error. Use it in CI, Docker builds, and release scripts; never during day-to-day development where you are adding or removing packages.
Related commands
npm install
Installs a package (and its dependencies), adding it to package.json and refreshing package-lock.json. Without arguments, installs everything already declared in the current project's package.json.
npm audit
Submits the dependency tree to the registry's security advisory database and reports known vulnerabilities. Exits non-zero when problems at or above the audit level are found.
npm config
Reads and writes npm configuration values across user, project (.npmrc), and global levels. Alias: `c`; `npm config list -l` shows every effective setting including defaults.
npm install --global
Installs a package into the global prefix so its bin scripts are on your PATH system-wide. Global installs live outside any project's node_modules.
npm uninstall
Removes a package from node_modules and drops it from the matching section of package.json and the lockfile. Aliases: `remove`, `rm`, `r`, `un`.