Services and User Management

A CI server must install Node.js dependencies for a project from a clean node_modules directory. The versions must match package-lock.json exactly, and the job must fail if the lock file and package.json disagree. Which command should the pipeline run?

Show the answer

Correct answerB. npm ci

npm ci removes node_modules, installs the exact versions in package-lock.json and fails if the lock file and package.json are out of sync. npm update is tempting but moves packages to newer versions allowed by the version ranges, which breaks reproducibility.