gpt4 book ai didi

Angular CLI 错误路径和代码 EEXIST

转载 作者:太空狗 更新时间:2023-10-29 17:41:57 26 4
gpt4 key购买 nike

我首先安装了 npm 并确保它是最新的。然后我尝试安装 angular 但我遇到了错误

~ kode$ sudo npm install -g @angular/cli

Password:

npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! path /usr/local/bin/ng

npm ERR! code EEXIST

npm ERR! Refusing to delete /usr/local/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /usr/local/bin

npm ERR! File exists: /usr/local/bin/ng

npm ERR! Move it away, and try again.


npm ERR! A complete log of this run can be found in:

npm ERR! /Users/kode/.npm/_logs/2018-02-15T13_10_57_836Z-debug.log

我不明白它是如何告诉我文件已经存在的,当我运行任何 ng 命令时它告诉我:

ng: command not found

我对节点和 Angular 都还很陌生,所以这是我尝试过的:

我尝试卸载 angular:sudo npm uninstall -g @angular/cli

然后重新安装它:sudo npm install -g @angular/cli

当然这并没有奏效。

如果你知道如何解决这个问题,请帮助初学者,谢谢。

最佳答案

您需要从 /usr/local/bin 中删除 ng 文件夹:

 sudo rm -rf /usr/local/bin/ng 

然后重试安装:

 sudo npm i -g @angular/cli 

关于Angular CLI 错误路径和代码 EEXIST,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48808384/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com