Reproducible Node Builds With npm ci
Blog post from Semaphore
npm clean-install (npm ci) offers a more robust alternative to npm install, focusing on consistency and speed within CI/CD processes by ensuring that the node_modules folder is always freshly installed and that any discrepancies between package-lock.json and package.json result in an error. While npm install is designed for developer convenience and allows for minor version updates, it can lead to inconsistencies across different environments, causing potential issues in collaborative projects. npm ci mitigates these risks by providing a stricter installation process that doesn't rely on cached files, ensuring stability across deployments. The choice between npm install and npm ci ultimately depends on the project's specific needs for speed and reliability, with npm ci being recommended for environments where consistency is crucial.