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

← All npm commands · npm vs pnpm vs Yarn · Fix Node OOM