Headmaster
Headmaster

Reputation: 2342

How to check and change the Nodejs version on Ubuntu?

I am using Ubuntu Linux.

How can I check current nodejs version? I guess, I have 6 version, but I am not sure.

And is there way to change it, because I need 4 version. Can some one give step by step commands?

Upvotes: 54

Views: 221954

Answers (5)

Duke Dadson
Duke Dadson

Reputation: 31

To change your node version, I'd recommend installing nvm. Once installed, switch versions follow the instruction below;

nvm use <any specified version you prefer "example v16.0.0">

Example:

nvm alias default 16

This will enforce as the current default version.

Upvotes: 3

Dinith
Dinith

Reputation: 1049

You can check your version by using this code (node -v) in linux terminal and If you want to upgrade it to stable version you can use following codes one by one.

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

Upvotes: 12

Himanshu
Himanshu

Reputation: 7373

Just type npm version in your command line and it will display all the version details about node, npm, v8 engine etc.

Upvotes: 2

James
James

Reputation: 82136

Open up the terminal and type node -v

To change your node version, I'd recommend installing nvm. Once installed, to switch versions it's as simple as

nvm use <version>

Upvotes: 83

Pavan Vora
Pavan Vora

Reputation: 1754

You can check your current NodeJS version by using command node -v. And changing your version can be done by using node version manager. The easiest way to do that is by running this $ npm install -g n now you can change your current NodeJS version using n (version) e.g. n 4.0.0.

node -v
npm install -g n
n 4.0.0

Upvotes: 26

Related Questions