1

When I inquire about the @angular/cli version through npm, it tells me it's version

npm list -g --depth=0 @angular/cli
>>> @angular/[email protected]

But when I inquire via ng --version, it tells me it's 8.0.0-beta.11. I'm not in a local angular project. I can't figure out how to thoroughly upgrade my global ng. Suggestions?

Edit: Here's some extra info as requested in comments:

sw_vers -productVersion # Show Mac OSX version
>>> 10.15.2

which -a ng
>>> /Users/magnus/.nvm/versions/node/v10.16.3/bin/ng
>>> /usr/local/bin/ng

/Users/magnus/.nvm/versions/node/v10.16.3/bin/ng --version
>>> ... Angular CLI: 8.0.0-beta.11 ...

/usr/local/bin/ng --version
>>> ... Angular CLI: 8.0.0-beta.11 ...
realpath /usr/local/bin/ng
>>> /usr/local/lib/node_modules/@angular/cli/bin/ng

cat ~/.npmrc
>>> ignore-scripts=false

I installed npm via nvm with the intention to only use that version. Not sure why I am seeing an ng executable in /usr/local/bin; I'm pretty sure I wouldn't have tried installed it via homebrew.

4
  • Did you try npm uninstall -g @angular/cli && npm install -g @angular/cli Commented Jan 7, 2020 at 21:11
  • Yes ........... Commented Jan 7, 2020 at 21:21
  • Did you restart your terminal after you've installed the newest @angular/cli version? Commented Jan 7, 2020 at 21:29
  • Check your $PATH and see where it's loading from. Update your question to include your OS, and check what you have in ~/.npmrc Commented Jan 7, 2020 at 21:29

1 Answer 1

1

OK, in my case the problem was that I had two npm installs on my Mac (one via homebrew and one via nvm). Despite that the nvm install of npm had priority in my $PATH, the version of ng that got priority was the one installed via the homebrew install of npm. So any effort I made to update/reinstall/etc the angular client using the nvm install of npm was having no effect on the version of the cli installed by the homebrew install of npm. (And even if I used the full path to ng as installed by the nvm version of npm, it was was somehow eventually always linking through to the version of ng installed by the homebrew install of npm.)

My solution was to just get rid of the homebrew install of npm and all its packages. The key here is to first use the full path to the homebrew install of npm to remove all global packages (e.g. /usr/local/bin/npm remove -g @angular/cli), and then to remove the homebrew install of npm itself (brew remove npm).

Now there is only the nvm install of npm in my path, and I was able to get the latest global install of the angular cli using npm install -g @angular/cli@next.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.