0

I have already Install node.js and npm.After these two I am running the command npm install --global @angular/cli but I am getting an error.

C:\Users>npm --v
5.6.0

C:\Users>node --version
v10.2.1

C:\Users>npm install --global @angular/cli
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.2 (node_modules\@angular\cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! path C:\Users\AppData\Roaming\npm\ng.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\Users\AppData\Roaming\npm\ng.cmd: node_modules\angular-cli\bin\ng symlink target is not controlled by npm C:\Users\AppData\Roaming\npm\node_modules\@angular\cli
npm ERR! File exists: C:\Users\AppData\Roaming\npm\ng.cmd
npm ERR! Move it away, and try again.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\AppData\Roaming\npm-cache\_logs\2019-05-14T05_33_11_503Z-debug.log
1

5 Answers 5

1

As suggested in logs. You have to delete the below file:

C:\Users\AppData\Roaming\npm\ng.cmd

This is because you might have other version or some other program is using it and npm is not able to delete as it doesn't have the correct access right for the same.

Just delete the file and try again. (Note: Make sure you are not using it and if doing so then newer version should support the functionalities required)

Sign up to request clarification or add additional context in comments.

Comments

1

I had the same issue once and fixed it by doing this, maybe it'll help you.

First open the cmd in Administrator mode ( Windows ) if its Linux just add sudo before the commands, then type the commands one by one

$ npm uninstall -g @angular/cli
$ npm cache clean
$ npm install -g @angular/cli

Let me know if it works :)

Comments

0

I think npm has old dependency cache. try this.

npm cache clean

Comments

0

I had the same problem, deleting ng.cmd and also %appdata%\npm\node_modules\@angular\cli folder solved the problem.

Comments

0
  1. Delete node Folder under program Files C:\Program Files (x86)
  2. Delete npm and npm-cache folders C:\Users<user_name>\AppData\Roaming
  3. Uninstall Node if installed from control panel
  4. Install stable version of node from official website https://nodejs.org/en/
  5. verify running below commands node -v and npm -v
  6. Run npm install -g @angular/cli

Above Steps worked for me..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.