Search code examples
blockchainethereumwindows-subsystem-for-linuxhardhat

Error HH502: Couldn't download compiler version list. Please check your internet connection and try again


I am following the process from https://hardhat.org/tutorial/creating-a-new-hardhat-project to create a new hardhat project. However, it is throwing an error in the contract compiling step; i.e. when I run yarn hardhat compile

Downloading compiler 0.8.9
(node:3732) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Error HH502: Couldn't download compiler version list. Please check your internet connection and try again.

HardhatError: HH502: Couldn't download compiler version list. Please check your internet connection and try again. 
    at /mnt/a/projects/Ethereum/hh-fcc/hardhat-simple-storage-2/node_modules/hardhat/src/internal/solidity/compiler/downloader.ts:149:17
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at CompilerDownloader.downloadCompiler (/mnt/a/projects/Ethereum/hh-fcc/hardhat-simple-storage-2/node_modules/hardhat/src/internal/solidity/compiler/downloader.ts:142:5)
    at SimpleTaskDefinition.action (/mnt/a/projects/Ethereum/hh-fcc/hardhat-simple-storage-2/node_modules/hardhat/src/builtin-tasks/compile.ts:551:9)
    at Environment._runTaskDefinition (/mnt/a/projects/Ethereum/hh-fcc/hardhat-simple-storage-2/node_modules/hardhat/src/internal/core/runtime-environment.ts:308:14)
    at Environment.run (/mnt/a/projects/Ethereum/hh-fcc/hardhat-simple-storage-2/node_modules/hardhat/src/internal/core/runtime-environment.ts:156:14)
    at SimpleTaskDefinition.action (/mnt/a/projects/Ethereum/hh-fcc/hardhat-simple-storage-2/node_modules/hardhat/src/builtin-tasks/compile.ts:678:36)
    at Environment._runTaskDefinition (/mnt/a/projects/Ethereum/hh-fcc/hardhat-simple-storage-2/node_modules/hardhat/src/internal/core/runtime-environment.ts:308:14)
    at Environment.run (/mnt/a/projects/Ethereum/hh-fcc/hardhat-simple-storage-2/node_modules/hardhat/src/internal/core/runtime-environment.ts:156:14)
    at Environment._runTaskDefinition (/mnt/a/projects/Ethereum/hh-fcc/hardhat-simple-storage-2/node_modules/hardhat/src/internal/core/runtime-environment.ts:308:14)

    Caused by: Error: getaddrinfo EAI_AGAIN binaries.soliditylang.org
        at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command

I'm running the code on windows with WSL using

node v16.13.2
yarn v1.22.15
hardhat v2.11.2

Here are my WSL configs

BUILD:    19042
BRANCH:   vb_release
RELEASE:  Ubuntu 20.04.3 LTS
KERNEL:   Linux 4.4.0-19041-Microsoft
UPTIME:   0d 3h 18m

Here's my hardhat.config.js

require("@nomicfoundation/hardhat-toolbox");

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.9",
};

Here's my repo link: https://github.com/J0SAL/hardhat-simple-storage


Solution

  • The code and everything are correct.

    I found the issue in my WSL setup.

    Right now I'm using Windows PowerShell and it's working fine.