To install packages via npm I typically just use
npm install. This works great, updates my
package.json, allows me to install one or more packages, etc. However, I just discovered (embarrassingly) the
npm ci command.
This is meant to be used in automated environments like continuous integration pipelines. It will install exactly what is defined in your
package-lock.json, while also being faster, safer, etc. This should definitely be used when installing npm packages in any automated environment.