Categories
Development

Node.js WSL

Install Node.js on WSL

Install Node.js on Windows Subsystem for Linux (WSL2)

I am following this instructions: https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl

Install Node Version Manager (nvm)

sudo apt-get install curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash

## Open NEW TERMINAL windows

# test installation
command -v nvm
nvm


# check version
nvm ls

->       system
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)


# check node version
node --version
v10.19.0

Install Node.js

# install LTS
nvm install --lts


# check version
nvm ls
->     v16.18.0
         system
default -> lts/* (-> v16.18.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.18.0) (default)
stable -> 16.18 (-> v16.18.0) (default)
lts/* -> lts/gallium (-> v16.18.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.20.1 (-> N/A)
lts/gallium -> v16.18.0


# check node version
node --version
v16.18.0


# check npm version
npm --version
8.19.2

Some npm commands

# Show installed Nodes
nvm ls
# Show available versions
nvm ls-remote
# Install latest version
nvm install node
# Install LTS version
nvm install --lts
# Install a specific version (list available -> example 16.18.0)
nvm install 16.18.0
# Use a specific version
nvm use 16.18.0
# Show npm version
npm --version

Leave a Reply

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