Setup NodeJS

Truffle command requires Node.js in your WSL environment to work

Update your system packages:

sudo apt update
sudo apt upgrade

Install NVM

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Load NVM

source ~/.bashrc

Install Node.js and npm: For Ubuntu or Debian-based WSL instances, you can use the following command:

sudo apt-get install nodejs
nvm install 19

You can also follow the official instructions for installing Node.js and npm for other distributions: https://nodejs.org/en/download/package-manager/

Verify the installation: Run the following commands to check if Node.js and npm are installed correctly:

node -v
npm -v
Home