You already now the npm install
command, right? It installs your dependencies defined in your package.json
and package-lock.json
. It will reuse existing packages in your node_modules
folder and may update the package-lock.json
file to match the actual installed versions. This is fine for development, but it is not what you want on your build or testing server.
The npm ci
command does a clean install of your dependencies. It removes the node_modules
folder and re-installs the dependencies. It will make sure that the package-lock.json
is up to date and will exit with an error if it is not. And will never update the package.json
or package-lock.json
.
# On your machine
npm install
# On your build or testing server
npm ci
See the npm documentation for more information.