31

I am having difficulties doing anything with the Angular CLI. I have Node, NPM. and Angular all installed, when I run the which command in the terminal they all exist in my /user/local/bin

This is my current node.js: v11.8.0

This is my current npm: 6.5.0

When I run ng -v I am unable to get the version and I get the following message:

$ ng -v
Node.js version v11.8.0 detected.
The Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.

Please update your Node.js version or visit https://nodejs.org/ for additional instructions.

I have tried uninstalling the Angular CLI but, getting the same results.

Tanner
  • 720
  • 1
  • 8
  • 17
  • try ```ng --version``` – Santosh Shinde Feb 13 '20 at 05:28
  • 1
    Or just reboot your system once and try again. – Mridul Feb 13 '20 at 05:31
  • I still get the same message from my post. – Tanner Feb 13 '20 at 05:31
  • Got the same result even after a reboot. – Tanner Feb 13 '20 at 05:35
  • the command should be >ng version – rickz Feb 13 '20 at 05:40
  • If I do ng version, I still get the same result. I am unable to complete any ng commands since I still keep getting the same error about my Node.js version. – Tanner Feb 13 '20 at 05:41
  • I would unistall and install. See answer at https://stackoverflow.com/questions/43931986/how-to-upgrade-angular-cli-to-the-latest-version – rickz Feb 13 '20 at 05:44
  • @rickz I've have tried uninstalling and re-installing following that SO post, and still got the same results... – Tanner Feb 13 '20 at 05:48
  • According to https://www.npmjs.com/package/@angular/cli you have proper Prerequisites. But, maybe something is wrong with your node or npm? – rickz Feb 13 '20 at 05:51
  • @rickz I find it very weird too, I followed the Prerequisites and I have installed node with Homebrew. I am using the same Node and NPM set up for another project that uses Nuxt.js and I'm not running into any issues there... And I rather not completely uninstall node and npm to interfere with that other project. – Tanner Feb 13 '20 at 05:57
  • 1
    One more thing, did you see what Mattijs posted in response to my comment under accepted answer at https://stackoverflow.com/questions/43931986/how-to-upgrade-angular-cli-to-the-latest-version that helped me. But today use 9.0.2 – rickz Feb 13 '20 at 05:58
  • @rickz Ok, after I uninstalled it and gave it a specific version to. install now it was able to work. I guess my system can only run angular 7 since any version after that causes me to get the same issue. – Tanner Feb 13 '20 at 06:03
  • @Tanner how did you install node on your system? – angularrocks.com Feb 14 '20 at 03:21
  • @kuncevic.dev I installed Nodejs with homebrew – Tanner Feb 16 '20 at 22:41
  • @Tanner just updated the answer how to uninstall nodejs if being installed that with a brew – angularrocks.com Feb 16 '20 at 23:30

7 Answers7

51

Note 22 Feb 2023: There is a great tool that was recently released called NGVM.
It might be really helpful maintaining Angular CLI versions.

I would recommend you to remove your NodeJS installation completely and re-install NodeJS through NVM (see steps below) or Volta. This way you can easily switch between multiple NodeJS versions and the other benefit of that for each active NodeJS version you may able to install specific Angular CLI version.

e.g:

nvm install 11  
nvm install 12
nvm alias default 12  
nvm use 11  
npm install @angular/cli -g

Also see some details on Angular CLI version here

P.S
If you where using brew, to uninstall NodeJS follow this steps:

brew uninstall node; 
# or `brew uninstall --force node` which removes all versions
brew cleanup;
rm -f /usr/local/bin/npm /usr/local/lib/dtrace/node.d;
rm -rf ~/.npm /usr/local/bin/node;
angularrocks.com
  • 26,767
  • 13
  • 87
  • 104
9

Angular CLI requires a current, active LTS, or maintenance LTS version of Node (https://angular.io/guide/setup-local#nodejs). which version 11 isn't.

Node.JS 11 is no longer supported by the Node.Js team as after six months, odd-numbered releases (9, 11, etc.) become unsupported. More info: https://nodejs.org/en/about/releases

Solution : Upgrade Node version to 12+

Renil Babu
  • 2,118
  • 1
  • 20
  • 29
7

As, the Angular CLI requires a minimum Node.js version of either v10.13 or v12.0.

STEP 1: Install v12.x

nvm install 12

STEP 2: Use v12.x

nvm use 12

STEP 3: Install Angular CLI

npm install @angular/cli -g

STEP 4: Check version, verify its installed

ng --version

sample image of output: https://i.stack.imgur.com/9jr15.png

Karan Joshi
  • 71
  • 1
  • 1
6

For node v8 install version of angular cli 7.3

npm i @angular/cli@7.3.10
Manuel Spigolon
  • 11,003
  • 5
  • 50
  • 73
luis alvarez
  • 61
  • 1
  • 1
4

Searched for any references of unwanted versions and found it in node_modules in user folder.

rm -rf ~/node_modules

Checked with:

npx node -v

and it gave me desired version.

Maxime Lyakhov
  • 140
  • 1
  • 11
3

I also faced the same problem, did below steps, and was able to resolve

nvm install 12
nvm use 12
npm install @angular/cli -g
ng --version
Rajitha Bhanuka
  • 714
  • 10
  • 11
2

My solution was to simply go to the node.js download website, get the current/latest version of the software and install it on my computer. After that, the ng new command worked as expected.

AllJs
  • 1,760
  • 4
  • 27
  • 48