當使用 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開發環境