使用NPM在Ubuntu上全局安装Electronic
使用NPM全局安装电子时,试图解决此问题并得到以下错误:
ole@mki:~/angular-electron$ sudo npm install electron -g /usr/bin/electron -> /usr/lib/node_modules/electron/cli.js
> electron@1.7.12 postinstall /usr/lib/node_modules/electron
> node install.js
/usr/lib/node_modules/electron/install.js:48
throw err
^
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/electron/dist'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.7.12 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.7.12 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! /home/ole/.npm/_logs/2018-02-03T03_28_15_952Z-debug.log
回答:
正如npm提议的那样:
mkdir ~/.npm-global npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
通过这样做,您可以将全局npm软件包的范围限制在用户帐户内,而不是在计算机中的所有用户之间共享。即使您是唯一的用户,也建议这样做。:-)
以上是 使用NPM在Ubuntu上全局安装Electronic 的全部内容, 来源链接: utcz.com/qa/409153.html