【问题标题】:angular install cli errno -13 [duplicate]角度安装cli errno -13 [重复]
【发布时间】: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


    【解决方案1】:

    在 linux 上,我不得不使用 sudo npm install...

    【讨论】:

      【解决方案2】:

      从错误消息看来,文件夹没有写入权限。

      如果您使用的是 windows 机器,请在“以管理员身份运行”中打开命令提示符并执行命令。

      如果您使用的是 Mac,则必须使用 chmod 777 /usr/local/lib/node_modules 授予权限

      【讨论】:

        【解决方案3】:

        由于Angular 8的最新版本,需要Node.js 10.9.0或更高版本。

        在您的操作系统上升级Node.js

        查看文档以设置您的环境:https://angular.io/guide/setup-local

        【讨论】:

          猜你喜欢
          • 2021-04-03
          • 2020-04-23
          • 1970-01-01
          • 2021-03-20
          • 1970-01-01
          • 2017-11-08
          • 2018-11-07
          • 2023-03-04
          • 1970-01-01
          相关资源
          最近更新 更多