无法在全球范围内安装任何Node软件包Ubuntu Digital Ocean

时间:2018-08-03 03:38:52

标签: node.js ubuntu npm

尝试了一切。尝试了下面的所有步骤,但没有成功,因此我将液滴滴下,然后重新构建以重新尝试。我正在使用Ubuntu。一旦进入ssh,首先要通过以下命令安装节点和npm:

https://nodejs.org/en/download/package-manager/

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

然后

npm -v
5.6.0
node -v
v8.11.3

然后我尝试在全局安装软件包。我尝试了电子,但失败了,所以当我收到此处记录的修复程序的权限错误时,我开始弄乱节点模块文件夹:

https://askubuntu.com/questions/869168/node-modules-have-755-permissions-what-permissions-should-i-set-so-that-npm-don

没有运气。因此,我尝试了此处记录的解决方案: NPM global install "cannot find module"

echo $NODE_PATH
/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript:/home/username/.npm-global/lib/node_modules

所以那也不起作用。现在,当我尝试在全球范围内安装任何软件包时,就会出现以下错误:

npm install -g electron

我得到:

Error: Cannot find module '/root/.npm-global/lib/node_modules/nightmare/node_modules/electron/install.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.8.7 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.8.7 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-08-03T03_26_03_827Z-debug.log

我尝试安装的所有软件包的此错误。不知道还有什么尝试。不想消灭水滴并重新开始...

0 个答案:

没有答案