Angular-cli: ng --version reports wrong version number

Created on 1 Mar 2017  Â·  9Comments  Â·  Source: angular/angular-cli

After installing angular-cli to the latest, the --version command returns version 1.0.0-beta.30 instead of 1.0.0-rc.0

OS?

Windows 10

Versions.

This is what is at issue.

Repro steps.

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

The log given by the failure.

-- @angular/[email protected]
+-- @angular/[email protected]
+-- @angular/[email protected]
...
PS C:\Projects> ng --version
@angular/cli: 1.0.0-beta.30
node: 6.9.5
os: win32 x64

All 9 comments

I just tried your reproduction steps and got the following:

development » ng -v
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0-rc.0
node: 6.9.5
os: darwin x64

Would you mind doing the following?

npm ls -g @angular/cli

Just recreated the issue on my home machine. I update my home machine from 1.0.0-beta.24, and after the update following the above steps, it still says that the version is 1.0.0-beta.24.

If I run the command you gave, I get the following:
C:\Users\bklik\AppData\Roaming\npm
-- @angular/[email protected]

Great, so globally you have rc.0 installed, as I had hoped.

Doing ng -v inside the directory of a project will return the local version of the CLI being used, no the global version. This includes folders that have a node_modules folder with the CLI installed in it.

Can you go outside any project directory (say C:\) and try ng -v?

Yes, I am doing this outside a project folder. But, just in case I did it at c:\ and got:
PS C:\> ng -v
angular-cli: 1.0.0-beta.24
node: 6.9.3
os: win32 x64
PS C:\>

It looks like you still have angular-cli installed. Try uninstalling angular-cli and @angular/cli, then reinstalling @angular/cli.

Shout out to @hansl for noticing the angular-cli in your last comment.

I've done that already, but I'll do it again.

Even after running npm uninstall -g @angular/cli and npm uninstall -g angular-cli then reinstalling, I found that it still didn't work.

I tried an ng -v after uninstalling both, and surprisingly found that it would still output the beta version of angular-cli. I looked in the C:\Program Files\nodejs\node_modules and found a folder called angular-cli. After removing it, and re-installing angular-cli, angular-cli would fail to run afterward.

I gave up, uninstalled nodejs. Deleted C:\Program Files\nodejs and deleted all npm and npm-cache folders from my AppData. Reinstall nodejs, and ran npm install -g @angular/cli@latest.

I'm now properly receiving the correct version:

PS C:\WINDOWS\system32> ng -v
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0-rc.0
node: 6.10.0
os: win32 x64

Not a real work around. I think the answer lies in where that 'angular-cli' folder in 'nodejs/node_modules' came from, and how to properly remove it.

@bklik I know there are cases in windows where npm global installs get out of sync and it really sucks to figure out where the leftover modules are. I think it might be related to nvm.

It's not a CLI issue though... the CLI can't really control that sort of stuff. So in that sense it's not something I want to leave open in this issue tracker.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

purushottamjha picture purushottamjha  Â·  3Comments

rwillmer picture rwillmer  Â·  3Comments

rajjejosefsson picture rajjejosefsson  Â·  3Comments

hareeshav picture hareeshav  Â·  3Comments

JanStureNielsen picture JanStureNielsen  Â·  3Comments