首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用NPM在Ubuntu上全局安装电子

使用NPM在Ubuntu上全局安装电子
EN

Stack Overflow用户
提问于 2018-02-03 11:34:10
回答 1查看 1K关注 0票数 0

尝试解析this question,但在使用NPM全局安装电子时出现以下错误:

代码语言:javascript
复制
    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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-02-03 18:21:59

作为npm proposes

代码语言:javascript
复制
 mkdir ~/.npm-global
 npm config set prefix '~/.npm-global'
 export PATH=~/.npm-global/bin:$PATH
 source ~/.profile

通过这样做,您可以将全局npm包的范围限制在您的用户帐户内,而不是在计算机中的所有用户之间共享。即使您是唯一的用户,这也是推荐的行为。:-)

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48593682

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档