【发布时间】:2019-12-12 02:52:09
【问题描述】:
我正在尝试安装 npm install -g @angular/cli 我得到这个错误
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
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! stack: '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! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/admin/.npm/_logs/2019-08-04T05_20_10_235Z-debug.log
反复尝试以下命令仍然无效。
1-我卸载nodejs并重新安装旧版本
~ brew uninstall node
~ which node
~ rm -rf /usr/local/bin/node
~cd /usr/local/lib
~ sudo rm -rf node
~ sudo rm -rf node_modules
2- 清洁现金
~ npm cache verify --force
~ npm cache clear --force
~ npm uninstall -g @angular/cli
~ npm install -g @angular/cli
节点版本 v8.16.0
npm 版本 6.4.1
【问题讨论】:
标签: node.js angular npm angular-cli