angularangular-cli

Ng v still showing older version number after updating to latest angular cli version?


I have issued the following commands as shown in the picture. I have got a a success message saying that angular cli has been update to 10.0 version.

But when I run the ng v command I am getting the old version number.

So did it really update? What is the issue here? How to update to latest version globally so that when I generate a new angular project through cli I get the latest version of angular in that project?

enter image description here

Pls note- I have tried closing the cmd and opeing a new one to check ng v . Still the same. I did this entire process two times.

Not working even after npm cache clean force

enter image description here


 c:\>cd Users

c:\Users>ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 10.0.1
Node: 10.16.3
OS: win32 x64

Angular:
...
Ivy Workspace:

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1000.1
@angular-devkit/core         10.0.1
@angular-devkit/schematics   10.0.1
@schematics/angular          10.0.1
@schematics/update           0.1000.1
rxjs                         6.5.5


c:\Users>cd ARPAN

c:\Users\ARPAN>ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.3
Node: 10.16.3
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.803.3
@angular-devkit/core         8.3.3
@angular-devkit/schematics   8.3.3
@angular/cli                 8.3.3
@schematics/angular          8.3.3
@schematics/update           0.803.3
rxjs                         6.4.0
typescript                   3.5.3


c:\Users\ARPAN>npm uninstall -g @angular/cli
removed 269 packages in 5.006s

c:\Users\ARPAN>npm cache verify
Cache verified and compressed (~\AppData\Roaming\npm-cache\_cacache):
Content verified: 497 (12436501 bytes)
Index entries: 753
Finished in 0.97s

c:\Users\ARPAN>npm install -g @angular/cli
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
C:\Users\ARPAN\AppData\Roaming\npm\ng -> C:\Users\ARPAN\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng

> @angular/cli@10.0.1 postinstall C:\Users\ARPAN\AppData\Roaming\npm\node_modules\@angular\cli
> node ./bin/postinstall/script.js

+ @angular/cli@10.0.1
added 269 packages from 206 contributors in 30.831s

c:\Users\ARPAN>ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.3
Node: 10.16.3
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.803.3
@angular-devkit/core         8.3.3
@angular-devkit/schematics   8.3.3
@angular/cli                 8.3.3
@schematics/angular          8.3.3
@schematics/update           0.803.3
rxjs                         6.4.0
typescript                   3.5.3


c:\Users\ARPAN>

I opened cmd in admin mode, then updated the angular cli there, It got updated successfully, but then when I open cmd again in normal mode it shows the older version.

So I opened cmd in aadmin mode in my folder c:/users>ARPAN i updated the angular cli version there , but still it shows the same older version. Pls check the logs that i have attached


Solution

  • Finally! I am able to solve it. In admin mode and in root (C:\Users>) folder the angular cli version was the latest one i.e, 10.0.1

    But when I was navigating to C:\Users\ARPAN> the version of angular cli was still 8.3.3 .

    
    C:\Users\ARPAN>cd..
    
    C:\Users>ng version
    
         _                      _                 ____ _     ___
        / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
       / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
      / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
     /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                    |___/
    
    
    Angular CLI: 10.0.1
    Node: 10.16.3
    OS: win32 x64
    
    Angular:
    ...
    Ivy Workspace:
    
    Package                      Version
    ------------------------------------------------------
    @angular-devkit/architect    0.1000.1
    @angular-devkit/core         10.0.1
    @angular-devkit/schematics   10.0.1
    @schematics/angular          10.0.1
    @schematics/update           0.1000.1
    rxjs                         6.5.5
    
    
    C:\Users>cd ARPAN
    
    C:\Users\ARPAN>ng version
    
         _                      _                 ____ _     ___
        / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
       / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
      / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
     /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                    |___/
    
    
    Angular CLI: 8.3.3
    Node: 10.16.3
    OS: win32 x64
    Angular:
    ...
    
    Package                      Version
    ------------------------------------------------------
    @angular-devkit/architect    0.803.3
    @angular-devkit/core         8.3.3
    @angular-devkit/schematics   8.3.3
    @angular/cli                 8.3.3
    @schematics/angular          8.3.3
    @schematics/update           0.803.3
    rxjs                         6.4.0
    typescript                   3.5.3
    
    

    I was not able to figure out what was causing the issue. I tried everything available on the internet and stack overflow.I tried npm cache clean --force npm cache verify. Nothing worked.

    Then I did the following steps-

    Then I looked inside C:\Users\ARPAN> I found a package.json file there which had the version of angular cli as8.3.3 the older one.

    1. I deleted that. <<<<<< this is the crucial step.
    2. Then I navigated to C:\Users\ARPAN\AppData\Roaming\npm-cache deleted evrything inside the folder.
    3. Ran npm uninstall -g @angular/cli
    4. npm cache clean --force
    5. npm install -g @angular/cli

    It worked as a charm! Here is the log!

    C:\Users\ARPAN>ng version
    
         _                      _                 ____ _     ___
        / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
       / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
      / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
     /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                    |___/
    
    
    Angular CLI: 10.0.1
    Node: 10.16.3
    OS: win32 x64
    
    Angular:
    ...
    Ivy Workspace:
    
    Package                      Version
    ------------------------------------------------------
    @angular-devkit/architect    0.1000.1
    @angular-devkit/core         10.0.1
    @angular-devkit/schematics   10.0.1
    @schematics/angular          10.0.1
    @schematics/update           0.1000.1
    rxjs                         6.5.5