我曾尝试使用diff命令在visual studio online中安装angular cli,但都失败了。
从Angular/Cli页面执行安装命令
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命令
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)
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命令
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‘
vsonline:~/workspace/AirWorkz$ ng
bash: ng: command not found我认为VS online的节点安装可能与传统安装不同?我试图找到要删除的'node_modules‘文件夹,但返回了很多结果。我是不是应该一个一个地删除?
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谢谢你的帮助。
发布于 2020-05-20 11:37:07
我设法找到了隐藏的文件夹并把它删除了。
vsonline:~$ rm -rf .npm-global然后我就可以毫无错误地运行angular cli安装了!感谢您的支持和启发!
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.jshttps://stackoverflow.com/questions/61895600
复制相似问题