无法使用命令行安装angular cli

时间:2018-11-06 14:08:36

标签: node.js angular npm angular-cli

我正在尝试使用命令安装cli。

sudo npm install -g @angular/cli@latest

但是会引发以下错误:

npm ERR! path /usr/bin/ng<br>
npm ERR! code EEXIST<br>
npm ERR! Refusing to delete /usr/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /usr/lib/node_modules/@angular/cli<br>
npm ERR! File exists: /usr/bin/ng<br>
npm ERR! Move it away, and try again.<br>
npm ERR! A complete log of this run can be found in: 
npm ERR! /home/sachin/.npm/_logs/2018-11-06T13_58_33_153Z-debug.log

我尝试了以下命令

sudo npm cache clear --force
sudo rm -rf /usr/local/bin/ng

但是每次都会遇到相同的上述错误。

1 个答案:

答案 0 :(得分:0)

尝试:

  • dateFormat
  • sudo npm uninstall -g @angular/cli
  • sudo npm cache clean =>确保选项
  • sudo rm -rf /usr/bin/ng