Setting up Node, npm, nvm, React, and Vue on Ubuntu within WSL2

Posted by

Installing node, npm, nvm, react and vue on Ubuntu in WSL2

Installing node, npm, nvm, react and vue on Ubuntu in WSL2

If you are using Windows Subsystem for Linux 2 (WSL2) on your Windows machine and want to install node, npm, nvm, react and vue on Ubuntu, here’s a step-by-step guide to help you get started.

1. Install WSL2 on Windows

First, make sure you have WSL2 installed on your Windows machine. You can follow the official Microsoft documentation to install WSL2 if you haven’t already.

2. Install Ubuntu on WSL2

Once WSL2 is installed, you can then install Ubuntu from the Microsoft Store. Simply search for “Ubuntu” in the store and click on the install button to get it set up on your machine.

3. Update and Upgrade Ubuntu

Open Ubuntu on WSL2 and run the following commands to update and upgrade the packages on your system:

sudo apt update
sudo apt upgrade

4. Install node and npm

To install node and npm, run the following commands in your Ubuntu terminal:

sudo apt install nodejs
sudo apt install npm

5. Install nvm

nvm (Node Version Manager) allows you to switch between different versions of node on your machine. To install nvm, run the following commands:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc

6. Install react and vue

Once nvm is installed, you can use it to install react and vue on your system. Here’s how to install react and vue using nvm:

nvm install --lts
nvm use --lts
npm install -g create-react-app
npm install -g @vue/cli

7. Verify installations

Finally, you can verify that node, npm, react and vue are installed correctly by running the following commands:

node -v
npm -v
create-react-app --version
vue --version

That’s it! You now have node, npm, nvm, react and vue installed on your Ubuntu in WSL2. Happy coding!