-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hardhat compile
randomly and quietly stops before compiling contracts
#3877
Comments
See:
This is due to a regression in the latest node versions 18 and 20. Somewhere after "Downloading compiler list for platform" when trying to a compiler, it failed to download it and failed silently. Try to use a node version other than the latest. I'm surprised the node team hasn't done a release yet since this is a widespread issue. |
@fuxingloh thanks for pointing that out, I tried node |
@fuxingloh I can confirm it works with the |
Wow, this is so weird. Thanks everyone for the info. I still don't quite understand why and when this happens, but it's good to know that changing the version of node fixes the issue. @sebastiendan I'm going to edit your issue so this information shows up first for people landing here. |
FWIW, Github actions is currently using Specifying a different minor version (e.g |
* Separate build:deploy command for compiling for deployment * Fixing our node version to 18.15.0 for now while we wait for a fix for NomicFoundation/hardhat#3877
* Separate build:deploy command for compiling for deployment * Fixing our node version to 18.15.0 for now while we wait for a fix for NomicFoundation/hardhat#3877
* Separate build:deploy command for compiling for deployment * Fixing our node version to 18.15.0 for now while we wait for a fix for NomicFoundation/hardhat#3877
* Separate build:deploy command for compiling for deployment * Fixing our node version to 18.15.0 for now while we wait for a fix for NomicFoundation/hardhat#3877
### Description To address NomicFoundation/hardhat#3877 Also reverts #2140
Fixes flaky hardhat compilation until a node release is made NomicFoundation/hardhat#3877
We want to fix problem with the `yarn build` (`hardhat compile`) command sometimes not generating expected artifacts. The problem is caused by the process silently quitting, which is related to the used version of Node (as descibed in NomicFoundation/hardhat#3877). We've confirmed the problem is reproducible on `v18.16.0`, now we're downgrading to `v18.15.0` to fix the issue.
…ther Set Node.js version to 18.15.0 We want to fix problem with the yarn build (hardhat compile) command sometimes not generating expected artifacts. The problem is caused by the process silently quitting, which is related to the used version of Node (as descibed in NomicFoundation/hardhat#3877). We've confirmed the problem is reproducible on v18.16.0, now we're downgrading to v18.15.0 to fix the issue.
Hi everyone, we just released Hardaht v2.16.1 which should fix this problem. |
When currently building the docker image of the contract, we are not including any artefacts, which - when running any hardhat script - yields the following error: ``` HardhatError: HH700: Artifact for contract "src/contracts/interfaces/IERC20.sol:IERC20" not found. ``` When looking at the build history we can see a subtle difference between a build [that is working](https://github.com/cowprotocol/contracts/actions/runs/5974729999/job/16209505930#step:5:253) and [one that isn't](https://github.com/cowprotocol/contracts/actions/runs/5975825913/job/16212645253#step:5:248): ``` #11 0.750 $ hardhat compile --force #11 4.073 Warning: unable to recover token list from 1inch #11 4.364 Downloading compiler 0.7.6 #11 4.826 Downloading compiler 0.7.6 **#11 17.88 Compiled 58 Solidity files successfully** #11 18.27 $ tsc && tsc -p tsconfig.lib.esm.json && tsc -p tsconfig.lib.commonjs.json ``` vs ``` #11 0.860 $ hardhat compile --force #11 4.335 Warning: unable to recover token list from 1inch #11 4.646 Downloading compiler 0.7.6 #11 5.211 $ tsc && tsc -p tsconfig.lib.esm.json && tsc -p tsconfig.lib.commonjs.json ``` The latter doesn't seem to compile any artefacts. According to NomicFoundation/hardhat#3877 this is due to a URL parser behavior change in Node 18.16 that can lead to silent Download failures. It's still no entirely clear to me why it sometimes works (maybe because of some intermittent error) ### Test Plan I hope this works, or at least tells us why the files are not being compiled
Edit by @fvictorio: Hardhat 2.16.1 should this problem.
Version of Hardhat
2.14.0
What happened?
npx hardhat compile
sometimes goes on with compiling contracts and sometimes (seems totally random) silently stops at theDownloading compiler ...
step before any contracts are actually compiled. This issue is reproducible with no contracts already compiled and in docker.Minimal reproduction steps
Here's a simple repository where you can observe the problem: repo.
This CI workflow run shows in the logs that the compilation didn't happen: log.
In addition, one can run the docker container in interactive mode and manually run the
build
command to see that, again, the command sometimes doesn't build nor throws an error but simply quietly stops without compiling (same output as the CI log above):docker run --rm -it ghcr.io/sebastiendan/hardhat-compile-issue:main bash
npm run build
(run the above multiple times by exiting the container and re-running the two commands above)
Search terms
no compilation
The text was updated successfully, but these errors were encountered: