您的位置:首页 > 产品设计 > 产品经理

sudo npm install错误

2017-05-02 15:32 639 查看
在执行
sudo npm install
时发生错误

错误代码如下:

> node install.js

npm ERR! Linux 3.13.0-96-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.8.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1

npm ERR! electron@1.6.6 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.6.6 postinstall script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron package,
npm ERR! not with npm itself.


最终的解决方法是使用“cnpm”,可直接看最后

尝试过程:

通过n把nodejs升级到最新稳定版本

sudo npm install -g n
sudo n stable


升级npm

sudo npm -g install npm


仍然不行,修改了源,也不行。

最终通过使用cnpm,解决问题。

终端中执行:

sudo npm install -g cnpm --registry=https://registry.npm.taobao.org


然后再次尝试,执行
sudo cnpm install
即可。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nodejs electron npm