node version manager

n is the node version manager. To install, run

npm install n -g

To list versions of node.js available, run

n ls

To see all available node versions, run

n lsr

To install the latest stable node.js

n stable

To install a specific version of node.js

boby@sok-01:~$ n lsr
Listing remote... Displaying 20 matches (use --all to see all).
18.10.0
18.9.1
18.9.0
18.8.0
18.7.0
18.6.0
18.5.0
18.4.0
18.3.0
18.2.0
18.1.0
18.0.0
17.9.1
17.9.0
17.8.0
17.7.2
17.7.1
17.7.0
17.6.0
17.5.0
boby@sok-01:~$ sudo n 18.10.0
  installing : node-v18.10.0
       mkdir : /usr/local/n/versions/node/18.10.0
       fetch : https://nodejs.org/dist/v18.10.0/node-v18.10.0-linux-x64.tar.xz
     copying : node/18.10.0
   installed : v18.10.0 (with npm 8.19.2)
boby@sok-01:~$ node --version
v18.10.0
boby@sok-01:~$ n ls
node/12.18.4
node/18.10.0
boby@sok-01:~$ 

To change the Node.js version, run

sudo n

It will show a text-based menu to select the node version you need.

You can see all installed node.js versions in the folder

/usr/local/n/versions/node

Node.Js

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *