[FAQ][Hardhat] Error HH501: Couldn't download compiler version 0.8.0. Please check your connection.

当使用 npx hardhat compile 命令编译智能合约时,会先下载你在 hardhat.config.js 配置中对应版本的 solidity 编译器。

当网络不可达时,就会提示无法下载的错误。

至少有两种方式可以解决:

1. 通过指定环境变量 HTTP_PROXY 或 HTTPS_PROXY 的方式。

https://github.com/nomiclabs/hardhat/issues/1280

https://github.com/nomiclabs/hardhat/pull/1291

2. 使用下载下来的 solc ,然后在配置 hardhat.config.js 中进行定义。

https://github.com/fvictorio/hardhat-examples/tree/master/custom-solc

Refer:Hardhat开发环境

Link:https://www.cnblogs.com/farwish/p/15707798.html

原文地址:https://www.cnblogs.com/farwish/p/15707798.html