Hardhat for Visual Studio Code is the official Hardhat extension that adds advanced support for Solidity to VSCode. If you use Visual Studio Code, give it a try!
You can skip this section if you already have a working Node.js
>=16.0 installation. If not, here's how to install it on Ubuntu, MacOS and Windows.
Copy and paste these commands in a terminal:
sudo apt update sudo apt install curl git curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt-get install -y nodejs
Make sure you have
git installed. Otherwise, follow these instructions.
There are multiple ways of installing Node.js on MacOS. We will be using Node Version Manager (nvm). Copy and paste these commands in a terminal:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash nvm install 18 nvm use 18 nvm alias default 18 npm install npm --global # Upgrade npm to the latest version
If you are using Windows, we strongly recommend you use Windows Subsystem for Linux (also known as WSL 2). You can use Hardhat without it, but it will work better if you use it.
To install Node.js using WSL 2, please read this guide.
Make sure you also have
git installed on WSL.
If your version of Node.js is older and not supported by Hardhat follow the instructions below to upgrade.
sudo apt remove nodejsin a terminal to remove Node.js.
- Find the version of Node.js that you want to install here and follow the instructions.
sudo apt update && sudo apt install nodejsin a terminal to install Node.js again.
You can change your Node.js version using nvm. To upgrade to Node.js
18.x run these in a terminal:
nvm install 18 nvm use 18 nvm alias default 18 npm install npm --global # Upgrade npm to the latest version