I am getting this error
npm ERR! cb.apply is not a function
in Linux while doing npm install
although my npm version is 6.9.0. My node version is v12.18.3. How to resolve this issue?
To resolve this issue, you need to update npm to v6. 10.0 and above. When this happens, then your next option is to download the latest version of Node from nodejs.org. The latest LTS version should be enough to resolve the issue.
The cb() function mentioned above is a vanilla callback function. The function was used by the npm install command to mark when an install is completed. The error means that the installation process was interrupted and left unfinished.
Would be helpful if you shared if it's Windows or Linux, but the error seems to occur on Windows. Possible solution:
1. Go to C:\Users(your username)\AppData\Roaming 2. Delete the npm folder (possibly back it up) and if there is one npm cache folder. 3. Run `npm cache clear --force` (--force is now required to clean cache)
After that, npm install
should work fine.
Since this question is fairly active and a top google result for this issue (I know the OP is using Linux) and we have every other OS covered in this list. Here is how to fix it on a Mac.
On a Mac you do not have the AppData\Roaming
folder, so simply run npm root -g
and then navigate to the hidden directory and delete the node_modules
there. If using nvm
you'll need to rerun nvm use x.x.x
(where x.x.x
is your version).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With