0

I have tried diff commands to install angular cli in visual studio online but they all failed

Installation command from Angular/Cli page

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

Angular/Cli command with --force flag

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

Tried with sudo (superuser 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

It's still failed, now i mix sudo + --force command

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

I dont understand why it keep refusing even i put sudo. It seems like "ng" already installed. But when i execute it couldn't recognize 'ng'

vsonline:~/workspace/AirWorkz$ ng
bash: ng: command not found

I think VS online's node installation could be different from traditional installation? i tried to find 'node_modules' folder to delete but it return lots of results. Shouldn't i delete one by one?

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

Thanks for the helps.

Weilies
  • 500
  • 1
  • 7
  • 27
  • 1
    Does this answer your question? [npm ERR! Refusing to delete / code EEXIST](https://stackoverflow.com/questions/46541371/npm-err-refusing-to-delete-code-eexist) – ruth May 19 '20 at 16:09
  • @MichaelD - no luck, too many folders. Or there is easier way if i could install from 'Extensions' tab? – Weilies May 20 '20 at 03:18

1 Answers1

0

i managed to findout the hidden folder and delete it

vsonline:~$ rm -rf .npm-global

then i can run angular cli installation without error! Thanks for the support and inspiration!

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
Weilies
  • 500
  • 1
  • 7
  • 27