Javascript &引用;module.js:557抛出错误“;从终端运行npm时

Javascript &引用;module.js:557抛出错误“;从终端运行npm时,javascript,node.js,npm,Javascript,Node.js,Npm,当我从终端运行npm时,我得到了这个错误,其他什么都没有。没有npm命令在工作,所有的命令都给出了相同的错误,我甚至不能安装依赖nodejs的程序 $npm module.js:557抛出错误^ 错误:找不到模块“semver” 位于Function.Module.\u解析文件名(Module.js:555:15) 在Function.Module.\u加载(Module.js:482:25) at Module.require(Module.js:604:17) 根据需要(内部/module.

当我从终端运行npm时,我得到了这个错误,其他什么都没有。没有npm命令在工作,所有的命令都给出了相同的错误,我甚至不能安装依赖nodejs的程序

$npm module.js:557抛出错误^

错误:找不到模块“semver”

位于Function.Module.\u解析文件名(Module.js:555:15)

在Function.Module.\u加载(Module.js:482:25)

at Module.require(Module.js:604:17)

根据需要(内部/module.js:11:18)

反对。(/usr/lib/node_modules/npm/lib/utils/unsupported.js:2:14)

在模块处编译(Module.js:660:30)

在Object.Module.\u extensions..js(Module.js:671:10)

在Module.load(Module.js:573:32)

在tryModuleLoad时(module.js:513:12)

在Function.Module.\u加载(Module.js:505:3)

这为我带来了好处(我正在使用OSX)


您的npm模块可能已损坏或安装了一些不合适的模块版本。我早些时候听到过类似的问题。看看这些URL,至少可以找到解决方案。。。我手动更新了semver,问题得到了解决,但我又遇到了另一个错误“cb()从未调用”,所以我受够了,切换到了Thread package manager。不管怎样,谢谢你!看看是否有帮助,效果很好。
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall --force node
brew install node