npm install: Flags That Matter in CI
npm install is the general-purpose installer; in CI you usually want npm ci instead.
npm install can mutate package-lock.json, which makes CI non-reproducible. When you must use it, pin behavior with explicit flags.
Common flags
--save-exact- pin exact versions--no-save- do not edit package.json--legacy-peer-deps- relax peer resolution--omit=dev- skip devDependencies
Example in CI
Install a single tool without touching manifests.
shell
npm install --no-save --no-audit npm-run-allIn CI
Prefer npm ci for the main install. Reach for npm install only for ad-hoc tooling. --legacy-peer-deps is a common escape hatch for ERESOLVE.
Key takeaways
npm installcan rewrite the lockfile.- Use
npm cifor reproducible builds. --legacy-peer-depsworks around ERESOLVE.