想全局安装electron却提示我没有权限:
sudo npm install -g electron
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron/electron-tmp-download-1374-1511880539207'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.7.9 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.7.9 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! /Users/pomelo/.npm/_logs/2017-11-28T14_49_00_758Z-debug.log
这就很奇怪了,去electron的github的issue里找到了解决办法,需要把npm相关的目录的权限转移到当前用户来:
官方解决:https://docs.npmjs.com/getting-started/fixing-npm-permissions
之后安装会卡在node install.js
这里,需要换国内的镜像,编辑/.npmrc:
electron_mirror=https://npm.taobao.org/mirrors/electron/
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。