How can I install @angular/cli on ubuntu 16.04 LTS?

Hi,
I try to install @angular/cli on ubuntu 16.04 but get following error:

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

I already installed a newer version of node.js:

nodejs -v
v8.11.3

and …

node -v
v0.10.48

@angular/cli

sudo npm install -g @angular/cli

/usr/local/bin/ng -> /usr/local/lib/node_modules/@angular/cli/bin/ng

> @angular/cli@6.0.8 postinstall /usr/local/lib/node_modules/@angular/cli
> node ./bin/ng-update-message.js

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/@angular/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ @angular/cli@6.0.8
added 248 packages in 26.533s

check…

ng -v

You are running version v0.10.48 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.

Thanks for your help

5 Replies

So uninstall your 0.10.48 version of Node and stick to 8.11.3.

I agree with Woet. It looks like Angular CLI is picking up the older version of Node.js. I'd recommend uninstalling the v0.10.48 version with the following:

apt-get remove node

Or, if you installed with brew:

brew uninstall node

it's a ubuntu 16.04 image here on linode.

I tryed "apt-get remove node" and get…
Package 'node' is not installed, so not removed

I have to uninstall with nvm?

ok, nvm install v8.11.3 Then

 ng -v
Angular CLI: 6.0.8
Node: 8.11.3
OS: linux x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.6.8
@angular-devkit/core         0.6.8
@angular-devkit/schematics   0.6.8
@schematics/angular          0.6.8
@schematics/update           0.6.8
rxjs                         6.2.1
typescript                   2.7.2

hmmm but now I have two kind of node.js.
node -v
and
nodejs -v

I have to remove nodejs now? or that does not matter?

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 http://davidwalsh.name/upgrade-nodejs

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct