Assuming that you already have WSL
installed in your windows.
- update Ubutu to it's latest version. Don't if you already have.
sudo
is equivalent to running asadministrator
sudo apt-get update
sudo apt-get upgrade
- install nvm which is node version manager.
This will install v0.35.0, check the nvm repo if there are newer versions.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
-
Restart your terminal after install.
-
Now install the latest the latest LTS version of node:
npm & npx
includeded
nvm install --lts
To update node just run the command again.
One thing you'll have to remember when use NVM is that you'll need to explicitly specify the node version you want to use (installing does it automatically on the end of the install), so next time you'll login to ubuntu you'll need to run the command:
nvm use --lts
You can also add this command to the end of your .bash_profile
file:
echo "nvm use --lts" >> .bash_profile