2

Whenever I enter ng in termial, it outputs

You are running version v6.14.3 of Node.js, which is not supported by Angular CLI v6. The official Node.js version that is supported is 8.9 and greater.

Please visit https://nodejs.org/en/ to find instructions on how to update Node.js

How to fix this issue?

This happens only in non root user account, works fine with root account

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Mahesh Uligade
  • 597
  • 8
  • 17
  • 2
    https://stackoverflow.com/questions/8191459/how-do-i-update-node-js Try this firtst – Yarince Jun 25 '18 at 12:55
  • _This happens only in non root user account, works fine with root account_ Two versions of node installed, one for sudo one for no su... – baao Jun 25 '18 at 12:57
  • Possible duplicate of [How do I update Node.js?](https://stackoverflow.com/questions/8191459/how-do-i-update-node-js) – georgeawg Jun 25 '18 at 13:06

3 Answers3

1

Your error message indicates, that your node version is not supported by angular. So you should rather update node. The current LTS is 8.11.3 which you can download here:

https://nodejs.org/en/

I've been using 'nvm' for this, it is a node version manager that allows you to install and switch between node versions very easily.

You can find it here:

https://github.com/creationix/nvm/blob/master/README.md

Nando Theeßen
  • 135
  • 1
  • 5
1

I was using nodejs v4.2.6 and npm v3.10.10 When I ran npm install -g @angular/cli, I think it tried to install latest version of angular-cli, hence I was getting this error.

You are running version v6.14.3 of Node.js, which is not supported by Angular CLI v6. The official Node.js version that is supported is 8.9 and greater.

Due to some reason, I didn't wanted to upgrade to latest node and npm packages, so I resolved it by npm install -g @angular/cli@1.1.1

Bhushan
  • 1,489
  • 3
  • 27
  • 45
0

Use n module from npm in order to upgrade node

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

To upgrade to latest version (and not current stable) version, you can use: sudo n latest

To undo:

sudo apt-get install --reinstall nodejs-legacy # fix /usr/bin/node
sudo n rm 6.0.0 # replace number with version of Node that was installed
sudo npm uninstall -g n

Found in David Walsh blog

mustaccio
  • 18,234
  • 16
  • 48
  • 57
Sohaib
  • 1,972
  • 3
  • 9
  • 19