npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules‘

Posted 柳鲲鹏

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules‘相关的知识,希望对你有一定的参考价值。

  • 具体错误
$ sudo npm install n
npm ERR! Linux 5.4.0-84-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "npm"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!   Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/tsit/npm-debug.log
  • 解决办法
sudo npm install --unsafe-perm=true --save-dev n
sudo npm install --unsafe-perm=true --allow-root --save-dev n

以上是关于npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules‘的主要内容,如果未能解决你的问题,请参考以下文章

npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules‘

npm 包无法安装“npm ERR!错误:EACCES:权限被拒绝”

gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/bcrypt/.node

gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied问题

npm install报错 Error: EACCES: permission denied

npm全局安装的时候报错Error: EACCES: permission denied, open 。。。。