Node error npm ERR! cb() never called

To anyone stumbling upon this question, if you are facing the same error message on npm install, then npm install --no-package-lock solved it for me.

As suggested in the referenced Github issue in Mohit Mutha's comment above, this is especially true if the command is ran in a CI/CD pipeline, or in my case, in Docker.

EDIT: Reason being is that the package-lock.json file already exists in your Docker image or CI pipeline

Full details


Our team encountered this error in our CI pipeline. However, the top answer of using --no-package-lock actually causes npm to also not use a present package-lock.json, which is definitely not the desired behavior for CI. Instead, using npm ci is now the recommended way to install in CI since it will use the existing package-lock (and nothing else).