Install Latest Version of Node.js on Ubuntu or WSL 2
·Mar 2, 2021·
2 min read
There are many ways to install Node.js on linux.
One way is installing node.js through apt. But this way you will install version 6.
My way of installing node.js is through
here are the steps to install nvm
Step 1 : Downoad and install NVM
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
Step 2: Restart the shell
You can just restart the shell or you can type this command
Now you can install Node.js
here are the nvm command to install Node.js
nodeis an alias for the latest version
The first version installed becomes the default. New shells will start with the default version of node.
nvm list # list all the installed versions of nodejs nvm ls-remote # list all the versions available to be installed nvm install node # installs the latest version nvm install 6.14.4 # or 10.10.0, 8.9.1, etc # this installs a specific version nvm use <version_number> # This will use the current version number in the current shell nvm unistall <version_number> # uninstall a version # ### Here is how you can change the version which will be used in any new shell by default nvm alias default <version_number> # EG : nvm alias default 14.15.1 # now the shel will start with node 14 by default # ### check the node version in use node --version
Did you find this article valuable?
Support Harshit Saini by becoming a sponsor. Any amount is appreciated!