首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Visual Studio Online编辑器中安装angular cli失败

在Visual Studio Online编辑器中安装angular cli失败
EN

Stack Overflow用户
提问于 2020-05-20 00:06:01
回答 1查看 57关注 0票数 0

我曾尝试使用diff命令在visual studio online中安装angular cli,但都失败了。

从Angular/Cli页面执行安装命令

代码语言:javascript
复制
vsonline:~/workspace/AirWorkz$ npm install -g @angular/cli
npm WARN deprecated request@2.88.2: 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 /home/vsonline/.npm-global/bin/ng
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/@angular/cli/bin/ng' -> '/home/vsonline/.npm-global/bin/ng'
npm ERR! File exists: /home/vsonline/.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!     /home/vsonline/.npm/_logs/2020-05-19T15_45_28_042Z-debug.log

带--force标志的Angular/Cli命令

代码语言:javascript
复制
vsonline:~/workspace/AirWorkz$ npm install -g @angular/cli --force
npm WARN using --force I sure hope you know what you are doing.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code EEXIST
npm ERR! path /home/vsonline/.npm-global/bin/ng
npm ERR! Refusing to delete /home/vsonline/.npm-global/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /home/vsonline/.npm-global/bin
npm ERR! File exists: /home/vsonline/.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!     /home/vsonline/.npm/_logs/2020-05-19T15_45_47_802Z-debug.log

已尝试使用sudo (超级用户do)

代码语言:javascript
复制
vsonline:~/workspace/AirWorkz$ sudo npm install -g @angular/cli
npm WARN deprecated request@2.88.2: 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 /home/vsonline/.npm-global/bin/ng
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/@angular/cli/bin/ng' -> '/home/vsonline/.npm-global/bin/ng'
npm ERR! File exists: /home/vsonline/.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!     /root/.npm/_logs/2020-05-19T15_46_22_233Z-debug.log

仍然失败,现在我混合使用sudo + --force命令

代码语言:javascript
复制
vsonline:~/workspace/AirWorkz$ sudo npm install -g @angular/cli --force
npm WARN using --force I sure hope you know what you are doing.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code EEXIST
npm ERR! path /home/vsonline/.npm-global/bin/ng
npm ERR! Refusing to delete /home/vsonline/.npm-global/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /home/vsonline/.npm-global/bin
npm ERR! File exists: /home/vsonline/.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!     /root/.npm/_logs/2020-05-19T15_46_47_028Z-debug.log

我不明白为什么它一直拒绝,即使我放sudo。它似乎已经安装了"ng“。但是当我执行的时候它不能识别'ng‘

代码语言:javascript
复制
vsonline:~/workspace/AirWorkz$ ng
bash: ng: command not found

我认为VS online的节点安装可能与传统安装不同?我试图找到要删除的'node_modules‘文件夹,但返回了很多结果。我是不是应该一个一个地删除?

代码语言:javascript
复制
vsonline:/home$ find -name 'node_modules'
./vsonline/.vscode-remote/extensions/angular.ng-template-0.901.7/client/node_modules
./vsonline/.vscode-remote/extensions/angular.ng-template-0.901.7/client/node_modules/vscode-languageclient/node_modules
./vsonline/.vscode-remote/extensions/angular.ng-template-0.901.7/server/node_modules
./vsonline/.vscode-remote/extensions/angular.ng-template-0.901.7/node_modules
./vsonline/.vscode-remote/extensions/ms-vsliveshare.vsliveshare-1.0.2169/node_modules
./vsonline/.vscode-remote/extensions/visualstudioexptteam.vscodeintellicode-1.2.7/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/extensions/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/extensions/emmet/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/extensions/emmet/node_modules/vscode-emmet-helper/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/extensions/typescript-language-features/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/extensions/ms-vscode.node-debug2/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/extensions/ms-vscode.node-debug2/node_modules/vscode-chrome-debug-core/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/extensions/ms-vscode.node-debug2/node_modules/mkdirp/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/node_modules/https-proxy-agent/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/node_modules/mkdirp/node_modules
./vsonline/.vscode-remote/bin/d69a79b73808559a91206d73d7717ff5f798f23c/node_modules/socks-proxy-agent/node_modules
./vsonline/.cache/typescript/3.8/node_modules
./vsonline/.nvs/deps/console-menu/node_modules
./vsonline/.nvs/deps/follow-redirects/node_modules

谢谢你的帮助。

EN

回答 1

Stack Overflow用户

发布于 2020-05-20 11:37:07

我设法找到了隐藏的文件夹并把它删除了。

代码语言:javascript
复制
vsonline:~$ rm -rf .npm-global

然后我就可以毫无错误地运行angular cli安装了!感谢您的支持和启发!

代码语言:javascript
复制
vsonline:~$ npm install -g @angular/cli
[..................] \ fetchMetadata: sill resolveWithNewModule @angular/cli@9.1.6 checking installable status
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
/home/vsonline/.npm-global/bin/ng -> /home/vsonline/.npm-global/lib/node_modules/@angular/cli/bin/ng

> @angular/cli@9.1.6 postinstall /home/vsonline/.npm-global/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61895600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档