Node.js – Cannot uninstall angular-cli

angularnode.jsnpm

I've tried several times to uninstall my angular-cli in order to update it but even if I follow the instructions provided on github:

  • npm uninstall -g @angular/cli
  • npm cache clean
  • npm install -g @angular/cli@latest

When I check using the command ng –version I still get the old version :

 angular-cli: 1.0.0-beta.26

 node: 7.7.1
 os: darwin x64

How can i fix this issue? Thanks

Best Answer

I have also faced the same issue in recent past for me I have do the following commands one by one in terminal.

sudo npm uninstall -g angular-cli
sudo npm cache clean

After this run

ng -v

If still get angular-cli version 1.0.0-beta.2x.x then run the following command

which ng

It will show the ng path. Go to the path and if it is linked with any file remove the same the link and actual ng file. In my case the link is in /usr/bin/ng and actual path of ng file is /lib/node_modules/@angular/cli/bin/ng.

sudo rm -rf /lib/node_modules/@angular/cli/bin/ng
sudo rm -rf /usr/bin/ng

Next you need to install @angular/cli using

sudo npm install -g @angular/cli

Close all the terminal and run ng -v and you are on. May be it will help someone. Thanks :)

Related Topic