npm 因“ERR!cb() 从未调用过”而崩溃

Moe*_*imo 2 node.js npm vue-cli

我试图安装 vue-cli 使用

npm install -g @vue/cli

我收到以下错误

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/moeketsi/.npm/_cacache/tmp'

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!  /home/moeketsi/.npm/_logs/2019-08-02T07_16_39_683Z-debug.log
Run Code Online (Sandbox Code Playgroud)

日志文件可在此处获得

当我尝试运行命令时,sudo我得到

sudo: npm: command not found
Run Code Online (Sandbox Code Playgroud)

我正在使用 node v10.16.1 并且 npm 版本是 6.9.0 。我安装了他们的node.js的网站。我尝试了这篇文章中的以下建议,也许是一个 稍微不同的案例,但这些建议都没有帮助。

Mig*_*uel 5

根据文档,如果您安装了以前的版本,则可能会遇到问题。您可以检查所有安装的软件包npm list -g

要卸载以前版本的 vue-cli 使用 npm uninstall vue-cli -g

如果不是这种情况,您可以尝试运行npm cache clear --force并再次尝试安装。