想全局安装electron却提示我没有权限:
创新互联于2013年创立,是专业互联网技术服务公司,拥有项目做网站、网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元泉港做网站,已为上家服务,为泉港各地企业和个人服务,联系电话:18982081108
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/