gogogo
管理员
管理员
  • UID25
  • 粉丝0
  • 关注0
  • 发帖数1377
阅读:3925回复:1

在开发项目安装依赖时(npm install) 往往会报 npm ERR! cb()never called!的错误

楼主#
更多 发布于:2020-12-04 13:49
如图:

 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! /Users/lenno/.npm/_logs/2019-04-04T08_14_08_150Z-debug.log


解决方法:
一、首先要以管理员模式打开cmd清除你的npm缓存 : npm cache clean -f

npm cache clean -f

二、清除完缓存后,安装最新版本的Node helper: npm install -g n
注意:如果出现npm ERR! notsup Unsupported platform for n@2.1.8: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})
这样错误信息
如图:
 
 
然后执行以下    npm install -g n --force
如图:
 
三、告诉助手(n)安装最新的稳定版Node:n stable
四、完成上一个命令后,您将获得最新信息。让我们再次运行安装: npm install
如果在执行npm install 非常缓慢的时候,可以试着更换镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
如图

再执行 cnpm install,这时候就比较快一些安装依赖文件  
安装完依赖文件后,执行 cnpm run dev ,项目就启动了。
 
以上是开发遇到的一个小问题,如有不足可以随时提出。谢谢
gogogo
管理员
管理员
  • UID25
  • 粉丝0
  • 关注0
  • 发帖数1377
沙发#
发布于:2020-12-04 13:50
游客


返回顶部