node.js - 错误 "Cannot find module ' npmlog '"after "npm 更新 -g"

标签 node.js npm nvm

我有 NVM 0.30.1 并用它在 Fedora 22 上安装 node.js v5.4.0(带有 NPM 3.5.4)。当我运行 npm update -g 时,我收到以下信息警告:

npm WARN EBUNDLEOVERRIDE Replacing bundled npm > init-package-json with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > node-gyp with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > npm-install-checks with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > npmlog with new installed version
npm WARN EBUNDLEOVERRIDE Replacing bundled npm > read-package-json with new installed version

然后,当我运行 npm 时,我得到了这个错误:

module.js:328
    throw err;
    ^

Error: Cannot find module 'npmlog'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at /home/peflorencio/.nvm/versions/node/v5.4.0/lib/node_modules/npm/bin/npm-cli.js:20:13
    at Object.<anonymous> (/home/peflorencio/.nvm/versions/node/v5.4.0/lib/node_modules/npm/bin/npm-cli.js:76:3)
    at Module._compile (module.js:398:26)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)

有谁知道它是什么以及如何解决它?

谢谢

最佳答案

为我解决这个问题的是

sudo rm -rf /usr/local/lib/node_modules/

然后重新安装 Node (使用 npm)。

关于node.js - 错误 "Cannot find module ' npmlog '"after "npm 更新 -g",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34702617/

相关文章:

json - 如何在 Angular2 中访问名称中带有破折号的 JSON 数据?

node.js - 警告 : NODE_ENV value of 'test ' did not match any deployment config file names

npm - 如何在 "nvm"中运行 "oh my zsh"?

ruby - 如何在 Makefile 中使用 rvm?

javascript - 我可以从我的 nuxt.js 项目中获取所有潜在路线的列表吗?

node.js - 在多个浏览器上运行测试(顺序)

javascript - npm 仅在 index.js 发生更改时更新

javascript - 如何解决 npm start 上的这个 Node js 错误?

html - Angular 6 的路由不适用于 "Router"模块,我想我有一个错误,但我不知道它是什么

nodes - 永久降级NVM中的节点版本