The short version
npm ci is npm's clean install command: it installs the project exactly as package-lock.json records it and never rewrites that file. Use it to reproduce a reviewed dependency tree before accepting an AI-generated change, then test the business workflow. A successful install is evidence about the build input, not proof that a new package is trustworthy or maintainable.
The new dependency is part of the change
An AI coding agent can solve a small task by importing a new package. The visible application diff may be short, while the maintenance commitment grows. Ask what the package provides, why existing code cannot reasonably cover the need, and who will own future updates.
Verify the exact package identity against its official repository and registry entry before installation. Review the relevant version, runtime requirements, license and installation behavior. A plausible name in an agent response is a proposal to investigate, not evidence that the package is the intended project.
This applies to a Node.js service or interface connected to a legacy system. It does not mean the older system needs to be rewritten or that every useful dependency should be rejected. The goal is to make additions deliberate and reviewable.
npm ci vs npm install: freeze the reviewed input
Current npm documentation (version 12, checked on 18 November 2026) says npm ci requires a lockfile (package-lock.json or npm-shrinkwrap.json), exits with an error when it does not match package.json, removes an existing node_modules directory and does not rewrite the manifest or lockfile. It installs the project, rather than adding an individual dependency. Test it in an isolated checkout intended for that purpose.
npm install, by contrast, updates the lockfile whenever it changes node_modules or package.json, so it belongs to the deliberate update step. The lockfile records the exact tree, including where each package was resolved from and an integrity hash. Review its changes alongside package.json, including unexpected indirect dependencies and changed sources. Keep the dependency update separate enough that a reviewer can explain why the tree changed.
Record Node.js and npm versions, platform and project installation configuration. A locked tree does not make every runtime identical. Do not delete and regenerate the lockfile merely to silence a failure without understanding which dependency decisions would change.
A small import can affect an old business rule
Illustration, not a customer case: an agent adds a date library while updating an appointment export. The export now looks correct for ordinary dates, but an existing consumer expects local calendar dates without a timezone conversion. The new dependency may be legitimate and still participate in an incorrect change.
Before accepting it, capture the expected export for boundary dates, missing dates and the formats the existing consumer accepts. Compare the result after a clean installation with the agreed fixtures. Check the interface consumed by the old system, not just the new helper function.
The decision may be to keep the package, change how it is used or avoid adding it. Record the reason. A successful install and a passing unit test that mirrors the generated implementation do not decide whether the business behavior is right.
Separate installation, security signals and workflow evidence
npm audit asks your default registry about known vulnerabilities in the project's dependencies. Its fix option runs a full install and changes the package tree; with --force it can install SemVer-major changes. Treat findings and proposed fixes as review input, and reassess changes before accepting them. A report with no findings is not proof of package trust or application correctness.
Decide which installation scripts are permitted before running an unfamiliar dependency. Use a disposable environment with limited access and no production credentials. Current npm documentation lists an install-script policy with options such as allow-scripts and dangerously-allow-all-scripts, which bypasses that policy. Avoid granting broad execution permissions just to get a green build. Document any required build step and verify the resulting application.
Keep three outcomes separate in the review: the intended dependencies were installed, relevant security findings were assessed, and the critical workflow passed its checks. If any outcome is unknown, say which one. Do not substitute a screenshot of a successful install for all three.
Keep the acceptance record for the next change
A useful handoff includes the package and reason for adding it, reviewed revision, lockfile diff, environment details, checks run and remaining limitations. Make the record short enough for another engineer to use when the package later needs an update or removal.
UVISION provides dedicated developers and managed projects with at least one full-time developer. For critical legacy systems, ongoing ownership includes dependencies, integration behavior and the business rules that rapid changes must preserve. AI can accelerate implementation while an experienced team keeps the resulting system maintainable.
Common questions
What is npm ci?
npm ci is npm's clean install command. It requires package-lock.json or npm-shrinkwrap.json, removes an existing node_modules directory and never rewrites package.json or the lockfile. In an AI coding workflow, run it in an isolated environment to check the dependency state under review. Installation success alone does not establish that a new package is appropriate.
What is the difference between npm ci and npm install?
npm install updates package-lock.json whenever it changes node_modules or package.json, so use it for a deliberate dependency update, then review the manifest and lockfile together. npm ci installs the whole project from the lockfile, fails if it does not match package.json and cannot add a single package. Use it to verify the resulting project state before acceptance.
Why use npm ci?
A clean-install check helps reveal whether a proposed change depends on an unexplained local installation state. For AI-generated work, that makes the review more reproducible. It still needs package identity checks, assessment of known vulnerability findings and tests of the affected business workflow. Record runtime and configuration details because a lockfile does not make every environment identical.
Further reading
Want to explore what this means for your systems?
Explore the relevant service