更新 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/