想全局安装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/