RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
npm全局安装包已经sudo仍然没有权限的解决方法

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


网站题目:npm全局安装包已经sudo仍然没有权限的解决方法
文章转载:http://scyingshan.cn/article/ihedeh.html