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:
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
Check if you have the hidden folder ".npm" in your Home directory and delete the old angular-cli folder.
https://github.com/angular/angular-cli#updating-angular-cli
If you're using Angular CLI 1.0.0-beta.28 or less, you need to uninstall angular-cli package first.
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
Then when it gets done successfully you may try:
ng --version
The following approach worked for me:
npm uninstall -g @angular/cli
and
npm cache verify
For those using Windows, I had this issue because :
npm uninstall -g @ angular/cli
, the folder AppData\Roaming\npm
were still containing a ng
fileI tried then to remove the ng
file manually, but for some reasons it was not possible (I did not have the right), even as admin.
The only hack I found was using a 'linux based' command (I used Git bash) as admin and removing this file from command line:
cd AppData/Roaming/npm
rm ng.cmd
For information: this was with the version 6 of the CLI. There is not problem anymore to remove manually this specific file after the update.
This sometime happens when you had actually installed @angular/cli using yarn and not npm.
You can verify this by looking in to yarn's global install folder.
You can remove it from yarn using
yarn global remove @angular/cli
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 :)
I found a solution, first, delete the ng file with
sudo rm /usr/bin/ng
then install nvm (you need to restart your terminal to use nvm).
then install and use node 6 via nvm
nvm install 6
nvm use 6
finally install angular cli
npm install -g @angular/cli
this worked for me, I wanted to update to v1.0 stable from 1.0.28 beta, but couldn't uninstall the beta version (same situation that you desrcibed). Hope this works
I had angular-cli version 1.0.0-beta.28.3
, and the only thing that worked for me was deleting the angular-cli directly from the global node_modules folder:
cd /usr/local/bin/lib/node_modules
rm -rf angular-cli
After that ng version
output was, as expected:
command not found: ng
And I could install the latest angular-cli version:
npm install -g @angular/cli@latest
Hope it helps...
Try to update via these steps found in the npm repo for the angular cli.
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest
There is also an angular cli migration guide. One other option (more involved) is to start a new project and migrate over by copying and pasting certain files. This can be found here in the "moving into the cli" section of the angular-cli github
While uninstalling Angular CLI I got the same message (as it had some permission issues):
Unable to delete .Staging folder
I tried deleting the .staging
folder manually, but still got the same error. I logged in from my administrator account and tried deleting the staging folder again manually, but to no avail.
I tried this (run as Administrator):
npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli.
Then I tried creating the project from my normal user account and it worked.
You have to use (without @)
npm uninstall -g angular/cli
because
If you're using Angular CLI beta.28 or less, you need to uninstall angular-cli package. It should be done due to changing of package's name and scope from angular-cli to @angular/cli https://github.com/angular/angular-cli
I could not get the angular-cli to go away. I FINALLY figured out a way to find it on my windows machine. If you have Cygwin installed or you are running linux or mac you can run which ng
and it will give you the directory the command is running from. In my case it was running from /c/Users/myuser/AppData/Roaming/npm/ng
Step 1:
npm uninstall -g angular-cli
Step 2:
npm cache clean
Step 3:
npm cache verify
Step 4:
npm cache verify --force
Note: You can also delete by the following the paths
C:\Users"System_name"\AppData\Roaming\npm and
C:\Users"System_name"\AppData\Roaming\npm-cache
Then
Step 5:
npm install -g @angular/cli@latest
You are using the beta version of angular CLI you can do this way.
npm uninstall -g @angular/cli
npm uninstall -g angular/cli
Then type,
npm cache clean
Then go to the AppData folder which is hidden in your users and go to roaming folder which is inside AppData then go to npm folder and delete angular files in there and also go to npm-cache folder and delete angular components in there.After that restart your PC and type
npm install -g @angular/cli@latest
This worked for me ??
I had the same problem. This doesn't work:
npm uninstall -g angular/cli
npm cache clean
instead use:
npm uninstall -g @ angular/cli
Source: Stackoverflow.com