【原创】真·修复npm ERR! cb() never called!的错误

# 真实可行的修复npm ERR! cb() never called!

遇到这种奇怪的错误,找了很久,试错了很久。发现有以下可行方式

在运行npm install时报如下错误:


npm ERR! cb() never called!

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

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\node-v12.6.0-win-x64\node-cache\_logs\2020-12-03T05_58_18_180Z-debug.log

# 方式一

最简单的方法,删掉 package-lock.json 文件,重新执行 npm install。 如果还是不行,就删掉 package-lock.json + node_module 文件,重新执行npm install。

删除文件可使用 rimraf node_modules ,详情可看另一篇文章。

# 方式二

网络问题,严重怀疑是网络不稳定造成的,可改用淘宝镜像 cnpm,或者 yarn 去执行install。

# 方式三(普遍方式)

反正我试过没用... 1.以管理员模式打开cmd清除你的npm缓存 (mac电脑在npm前加sudo):

npm cache clean -f

2.清除完缓存后,安装最新版本的Node helper:

 npm install -g n

3.然后安装npm包管理助手

npm install -g n --force

4.用n助手安装最新的稳定版的node

n stable