Process
How to Debug Hardhat
Last updated:
November 11, 2021
When using Hardhat tasks/scripts/deployment tools, from time to time the `--verbose` logging option may not provide enough insight about what is going wrong. In these cases, we need to be able to modify and link our own version of Hardhat. ### How to link your own version of Hardhat to your project Assume you are starting in a project folder `your-project`. The following script will do everything that is required to link and modify Hardhat. The below script assumes you use `yarn` but the method is compatible with `npm` as well. ```bash # Clone Hardhat next to your project cd .. git clone https://github.com/nomiclabs/hardhat.git # Build Hardhat core package cd hardhat/packages/hardhat-core yarn install yarn build # If successful, this point is where you should make edits to the Hardhat code # Then - recompile yarn build # Finally, make this Hardhat project available in yarn yarn link # Return to your project and link to your custom hardhat project cd ../../../your-project yarn link hardhat # From here you can use Hardhat normally ```
See Also: