【Error】Error: EACCES: permission denied, access/node_modules' npm ERR!

Error

cielo@ubuntu:~/go/src/github.com/hyperledger/fabric/blockchain-explorer$ npm install
npm WARN checkPermissions Missing write access to /home/cielo/go/src/github.com/hyperledger/fabric/blockchain-explorer/node_modules
npm ERR! path /home/cielo/go/src/github.com/hyperledger/fabric/blockchain-explorer/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/home/cielo/go/src/github.com/hyperledger/fabric/blockchain-explorer/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/home/cielo/go/src/github.com/hyperledger/fabric/blockchain-explorer/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/home/cielo/go/src/github.com/hyperledger/fabric/blockchain-explorer/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/home/cielo/go/src/github.com/hyperledger/fabric/blockchain-explorer/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.


   ╭──────────────────────────────────────╮
   │                                      │
   │   Update available 5.6.06.11.3    │
   │      Run npm i -g npm to update      │
   │                                      │
   ╰──────────────────────────────────────╯


npm ERR! A complete log of this run can be found in:
npm ERR!     /home/cielo/.npm/_logs/2019-09-17T04_26_10_331Z-debug.log

解决方法

方法一:
sudo
(不建议)

方法二:

stackoverflow.com

更改您的文件权限..像这样

首先检查谁拥有该目录

ls -la /usr/local/lib/node_modules
它拒绝访问,因为node_module文件夹归root所有

drwxr-xr-x   3 root    wheel  102 Jun 24 23:24 node_modules
所以这需要通过将root更改为您的用户来更改,但首先运行以下命令以检查当前用户 如何通过OS X中的命令行获取活动用户的名称?

id -un
要么

whoami

然后改变所有者

sudo chown -R [owner]:[owner] /usr/local/lib/node_modules
要么

sudo chown -R ownerName: /usr/local/lib/node_modules
要么

sudo chown -R $USER /usr/local/lib/node_modules

在我这就是:

cielo@ubuntu:~/go/src/github.com/hyperledger/fabric/blockchain-explorer$ sudo chown -R cielo: ~/go/src/github.com/hyperledger/fabric/blockchain-explorer/node_modules

成功截图:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值