Search code examples
angularangular-cliangular-cli-v7

Angular CLI upgrade from 6 to 7 not working


I tried doing an upgrade of node and the angular CLI on my mac using the instructions on the angular CLI github page, but the upgrade didn't work. After the upgrade that says it installed Angular CLI v7.1.4, if I do "ng --version", it still shows the old 6.2.1 version. Something that is interesting is that it looks like the npm install is putting code into node 10.10 which is the old version of node rather than the new version 11.6. How can I get the correct version of the angular CLI installed?

MacBook-Pro:~ XXXXXXXXXX$ npm uninstall -g @angular/cli
removed 360 packages in 2.149s

MacBook-Pro:~ XXXXXXXXXX$ npm cache verify
Cache verified and compressed (~/.npm/_cacache):
Content verified: 512 (18309157 bytes)
Index entries: 778
Finished in 0.834s

MacBook-Pro:~ XXXXXXXXXX$ npm install -g @angular/cli
/usr/local/Cellar/node/10.10.0/bin/ng -> /usr/local/Cellar/node/10.10.0/lib/node_modules/@angular/cli/bin/ng

> fsevents@1.2.4 install /usr/local/Cellar/node/10.10.0/lib/node_modules/@angular/cli/node_modules/fsevents
> node install

node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@11.6.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp) 
  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
../fsevents.cc:63:6: warning: field 'async_resource' will be initialized after
      field 'lockStarted' [-Wreorder]
   : async_resource("fsevents:FSEvents"), lockStarted(false) {
     ^
1 warning generated.
  SOLINK_MODULE(target) Release/fse.node
  COPY /usr/local/Cellar/node/10.10.0/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node
  TOUCH Release/obj.target/action_after_build.stamp
+ @angular/cli@7.1.4
added 360 packages from 195 contributors in 20.723s
MacBook-Pro:~ breynolds$ ng --version

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


Angular CLI: 6.2.1
Node: 11.6.0
OS: darwin x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.8.1
@angular-devkit/core         0.8.1
@angular-devkit/schematics   0.8.1
@schematics/angular          0.8.1
@schematics/update           0.8.1
rxjs                         6.2.2
typescript                   2.9.2

Solution

  • The answer is that the n version manager for node was getting in the way of the angular CLI installation. I only had one version of node installed when I used n to list the versions avaiable, but it was doing installations into an old version of node. I uninstalled n because it was causing problems with multiple things on my machine and now the Angular CLI installs correctly.

    sudo npm uninstall -g n

    Then I installed the Angular CLI

    npm install -g @angular/cli@latest

    Now the angular CLI works fine.