6

I have been trying to create a new project in Angular6 using the latest CLI, but have been unable to update. In an attempt to resolve, I have been simply trying to remove Angular CLI and start over but even that's not working!

From a random folder (without a project in it), if I run ng -v I get

Angular CLI: 1.5.4
Node: 9.4.0
OS: darwin x64
Angular:
...

So easily enough I try to run the following commands;

npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli

npm uninstall -g @angular/cli
npm cache verify

Then another ng -v, which I would expect it to complain that ng was not found, instead shows the same thing!

Angular CLI: 1.5.4
Node: 9.4.0
OS: darwin x64
Angular:
...

I was thinking this could be related to the fact that I use NVM to manage my Node version, but I haven't been able to find anything.

I have also tried npm install -g @angular/cli@latest after all the above, but when I check my ng version it still shows the same 1.5.4 instead of the latest version.

Some info;

  1. I'm not even in a project directory so there's no node_modules and everything is global -g
  2. I'm on OSX and using NVM to manage my Node versions, from the context of this I'm running node 9.4.0

@Everett pointed out a suggestion to delete any local references. I found that /Users/joshua/.nvm/versions/node stores extra node_modules directories. My problem persists though...

In the folder for /Users/joshua/.nvm/versions/node/**v9.4.0**/lib/node_modules I do not see any references to angular; however...

In /Users/joshua/.nvm/versions/node/**v6.11.5**/lib/node_modules I see folder @angular/cli

My thought here would be that if I were using node nvm version v9.4.0, which I am, is that it would be using that node's version of angular. Unfortunately this doesn't seem to be the case. I am hesitant to delete @angular refs from my other directories as I'm in the middle of other projects and don't want to break my environment right now, though I'm sure a full Node and NVM delete would resolve my issue.

Joshua Ohana
  • 4,457
  • 12
  • 43
  • 90

1 Answers1

1

I have version 6.0.1 installed. The steps you went through to uninstall did not work for me too.

So, go into you roaming folder and find npm and manually delete angular >> angular-cli

Angular was located at this path for me:

C:\Users\{me}\AppData\Roaming\npm\node_modules

Delete the angular folder and/or the angualr-cli folder

It seems like the old file structure is different from what it is today.

I then reinstalled using:

npm install -g @angular/cli@latest

and am now on:

Angular CLI: 6.0.3
Node: 8.11.1
OS: win32 x64
Angular:
...
Pezetter
  • 2,622
  • 2
  • 17
  • 37
  • I'm not even in a project directory, so there is no node_modules folder, and everything is global -g – Joshua Ohana May 22 '18 at 18:59
  • Hrmm so I'm on OSX and using nvm to manage my node version. For the active node version I removed @angular/cli and ng from everywhere... but apparently it's still present in other version. Maybe the way something is accessing it globally doesn't like different angular-cli versions across Node/NVM versions :-\ ---- I think I will just have to clear out everything and from from a clean Node/NVM environment – Joshua Ohana May 22 '18 at 19:20
  • Check out this post: https://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x – Pezetter May 22 '18 at 19:23
  • Good idea to try, not quite, I updated my answer with the info – Joshua Ohana May 22 '18 at 20:02
  • this solution worked for me. I experienced exactly as the OP. npm install/uninstall/verify didn't work. I was trying to upgrade from cli 9.1.7 to 9.1.9. So, in the end, I have to delete everything under Roaming/npm/ and Roaming/npm-cache. Then do the npm install cli command, and it worked cleanly. Hope this helps someone. – For Comment Jun 26 '20 at 16:36