node.js - 更新后的 npm 问题

标签 node.js macos npm npm-install

更新 npm 后,我无法在运行时使用 npm install

npm install

我有

npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './lib/extract-stream.js'

extract-stream.js的位置是/usr/local/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js

如果我跑

/usr/local/bin/npm install   # IT WORKS!



当我运行时

which npm 
# output: {my_home_path}/.npm-global/bin/npm   

当我运行时

npm -v 
# output: 6.7.0

/usr/local/bin/npm -v
# output 6.5.0

我该如何解决这个问题?

最佳答案

brew uninstall --force node    
sudo rm -rf /usr/local/lib/node_modules
brew install npm

工作得很好

关于node.js - 更新后的 npm 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54389644/

相关文章:

node.js - Gulp 4 无法完成 sass 任务

Node.js - 从不同位置加载 .env 文件

Node.js 导出的 Promise 链未与 Web API 回调按顺序运行

c++ - 分配内存时内存使用量不会增加

node.js - Windows 上的 npm run start 出现 "DEBUG=*"问题

angularjs - Angular 组件库 - 模板中的图像引用

node.js - NodeJs GUI 前端

javascript - nodejs中REPL的使用

swift - 创建类似 1Password 的 macOS 菜单栏应用程序

ios - 本地化问题 - 特定 x 通用