node.js - NPM 无法安装 @angular/cli 并显示 "File already exists"

标签 node.js angular npm

我想安装@angular/cli,但它不起作用,我已经重新安装了 Node,但问题仍然存在。

enter image description here

文本输出:

MacBook-Pro-de-MAC:~ macayoub$ npm -v
6.14.4
MacBook-Pro-de-MAC:~ macayoub$ node -v
v12.16.2
MacBook-Pro-de-MAC:~ macayoub$ sudo npm install -g @angular/cli
Password:
npm WARN deprecated <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cbb9aebabeaeb8bf8bf9e5f3f3e5f9" rel="noreferrer noopener nofollow">[email protected]</a>: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/@angular/cli/bin/ng
npm ERR! dest /Users/macayoub/.npm-global/bin/ng
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/@angular/cli/bin/ng' -> '/Users/macayoub/.npm-global/bin/ng'
npm ERR! File exists: /Users/macayoub/.npm-global/bin/ng
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/macayoub/.npm/_logs/2020-04-21T08_23_36_422Z-debug.log

最佳答案

您需要从/usr/local/bin 中删除 ng 文件夹 再次安装

sudo rm -rf /usr/local/bin/ng 
sudo npm i -g @angular/cli 

Angular CLI Error path and code EEXIST查找重复的问题

并回答:

https://stackoverflow.com/a/52621562/165260

还请避免发布重复的问题,首先在社区中搜索它们。 快乐编码!

关于node.js - NPM 无法安装 @angular/cli 并显示 "File already exists",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61339191/

相关文章:

javascript - 如何将 $scope.gridOptions.data 作为函数中的参数传递

angular - 无法获取字符串值的 Observable(angular2/typescript)

node.js - 在nodejs中安装opencv时出错?

node.js - 如何(重新)安装 Npm

javascript - 离线移动为 2factor 身份验证生成 6 位代码

node.js - NestJS 相当于express res.locals

javascript - Mongodb 查找不返回数组

asp.net - *ngFor 未显示任何记录

Angular/Typescript - 通配符模块声明

docker -/usr/bin/env : 'node\r' : No such file or directory