Skip to content

ng --version reports wrong version number #5138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bklik opened this issue Mar 1, 2017 · 9 comments
Closed

ng --version reports wrong version number #5138

bklik opened this issue Mar 1, 2017 · 9 comments

Comments

@bklik
Copy link

bklik commented Mar 1, 2017

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

@delasteve
Copy link
Contributor

delasteve commented Mar 2, 2017

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

@bklik
Copy link
Author

bklik commented Mar 2, 2017

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]

@delasteve
Copy link
Contributor

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?

@bklik
Copy link
Author

bklik commented Mar 2, 2017

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:\>

@delasteve
Copy link
Contributor

delasteve commented Mar 2, 2017

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.

@bklik
Copy link
Author

bklik commented Mar 2, 2017

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

@bklik
Copy link
Author

bklik commented Mar 2, 2017

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.

@filipesilva
Copy link
Contributor

@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.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants