Error HH502: Couldn't download compiler version list. Caused by: Error: self-signed certificate in certificate chain
Hello, I've seen similar errors around here, but I can't get it to compile.
This error occurs in a Windows 11 environment after successfully testing the same project on another computer. On the work PC, where the issue arises, I have verified that there is no proxy configured, and downloads are enabled within the corporate domain. In fact, I was able to update npm and node without any issues before attempting to compile the project using Hardhat. Despite these checks, the error persists when trying to compile.
node version v20.17.01
npm -v 10.8.2
>npx hardhat compile --show-stack-traces
Downloading compiler 0.8.24
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 C:\Users\emeoniz\Documents\REPOSITORIOS\000- GITHUB\utn-diplo\hardhat\node_modules\hardhat\src\internal\solidity\compiler\downloader.ts:177:17
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at MultiProcessMutex._executeFunctionAndReleaseMutex (C:\Users\emeoniz\Documents\REPOSITORIOS\000- GITHUB\utn-diplo\hardhat\node_modules\hardhat\src\internal\util\multi-process-mutex.ts:77:19)
at CompilerDownloader.downloadCompiler (C:\Users\emeoniz\Documents\REPOSITORIOS\000- GITHUB\utn-diplo\hardhat\node_modules\hardhat\src\internal\solidity\compiler\downloader.ts:162:5)
at SimpleTaskDefinition.action (C:\Users\emeoniz\Documents\REPOSITORIOS\000- GITHUB\utn-diplo\hardhat\node_modules\hardhat\src\builtin-tasks\compile.ts:583:7)
at Environment._runTaskDefinition (C:\Users\emeoniz\Documents\REPOSITORIOS\000- GITHUB\utn-diplo\hardhat\node_modules\hardhat\src\internal\core\runtime-environment.ts:359:14)
at Environment.run (C:\Users\emeoniz\Documents\REPOSITORIOS\000- GITHUB\utn-diplo\hardhat\node_modules\hardhat\src\internal\core\runtime-environment.ts:192:14)
at SimpleTaskDefinition.action (C:\Users\emeoniz\Documents\REPOSITORIOS\000- GITHUB\utn-diplo\hardhat\node_modules\hardhat\src\builtin-tasks\compile.ts:735:36)
at Environment._runTaskDefinition (C:\Users\emeoniz\Documents\REPOSITORIOS\000- GITHUB\utn-diplo\hardhat\node_modules\hardhat\src\internal\core\runtime-environment.ts:359:14)
at Environment.run (C:\Users\emeoniz\Documents\REPOSITORIOS\000- GITHUB\utn-diplo\hardhat\node_modules\hardhat\src\internal\core\runtime-environment.ts:192:14)
Caused by: Error: self-signed certificate in certificate chain
at TLSSocket.onConnectSecure (node:_tls_wrap:1627:34)
at TLSSocket.emit (node:events:514:28)
at TLSSocket._finishInit (node:_tls_wrap:1038:8)
at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:824:12)
Hey, are you attempting to do this from a machine on a corporate network?
The failure is in the http request to download the solc compiler from solc's webservers. Specifically:
Error: self-signed certificate in certificate chain
I suspect your connection to do the download is having to go through an intermediary.
Hi, thanks for your reply.
Yes, it is a corporate machine, but I have had no problems doing a npm install solc
The issue is occurring on downloading the compiler list from https://binaries.soliditylang.org/windows-amd64/list.json. There is likely something in your corporate network environment that makes is causing the error when downloading from that site.
We have had reports of issues with self-signed certs before (see https://github.com/NomicFoundation/hardhat/issues/3118), but these are very difficult for us to reproduce. There are some suggestions for getting certs working from a node app in that thread: https://github.com/NomicFoundation/hardhat/issues/3118#issuecomment-1387666796
Are you able to compile if you run the project under WSL?
Closing for now. We can reopen if more information becomes available.