Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check and change the Nodejs version on Ubuntu?

Tags:

node.js

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?

like image 485
Headmaster Avatar asked Aug 11 '17 10:08

Headmaster


People also ask

How do I change node js version in Ubuntu?

If you ever need to switch node versions, you can simply run nvm use <version-number> , for example nvm use v12. 18.1 . To list the different node versions you have installed with nvm, run nvm ls .

How do I check my NodeJS version?

To see if Node is installed, open the Windows Command Prompt, Powershell or a similar command line tool, and type node -v . This should print the version number so you'll see something like this v0. 10.35 .


2 Answers

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> 
like image 131
James Avatar answered Oct 01 '22 03:10

James


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 
like image 22
Pavan Vora Avatar answered Oct 01 '22 04:10

Pavan Vora