npm install error无法找到模块'read-package-json.js'

时间:2017-09-18 03:48:59

标签: npm

enter image description here

当我按照上面的图片安装npm时,错误信息显示:     错误:找不到模块'/private/var/folders/dm/bzjdbz_s1z1bby3p087g0jr00000gn/T/npm.922/package/bin/read-package-json.js'

详细信息请参见pic.any提示?谢谢

2 个答案:

答案 0 :(得分:2)

以下是我如何解决它:

    echo prefix=~/.npm-packages >> ~/.npmrc
    wget https://registry.npmjs.org/npm/-/npm-5.5.1.tgz
    tar xf npm-5.5.1.tgz
    cd package
    ./npm-cli.js install npm -g

答案 1 :(得分:0)

您可以按照以下步骤操作:

brew uninstall --force node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R $(whoami) /usr/local  #may not work
brew link --overwrite node
sudo brew postinstall node     #may not work

你可能会遇到sudo的问题,但不用担心没有它就可以工作:)