[FIXED] Node error npm ERR! cb() never called

Issue

When I am running the command npm install npm@latest -g
I am getting below error :-

npm WARN tar zlib error: unexpected end of file
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\dk\AppData\Roaming\npm-cache\_logs\2018-04-10T03_25_52_880Z-debug.log

i googled it and tried so many things,nothing worked.

Solution

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

Answered By – Anas Tiour

Answer Checked By – Willingham (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published