繁体   English   中英

使用NPM在Ubuntu上全局安装Electronic

[英]Installing electron globally on Ubuntu with NPM

使用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软件包的范围限制在用户帐户内,而不是在计算机中的所有用户之间共享。 即使您是唯一的用户,也建议这样做。 :-)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM