0

I am trying to write test cases in hardhat using Typescript and Typechain. But when I try to compile the contracts using npx hardhat compile, it is asking me to install @typechain/ethers-v5. When I try to install the package, it is throwing an error that the typechain and @typechain/ethers-v5 packages are conflicting. Can anyone resolve the issue?

Error:
enter image description here

Packages:

enter image description here

1 Answer 1

1

The issue comes from hardhat-typechain which hasn't been updated in over 2 years. (Roughly line 8 in your screenshot).

I recommend removing it in favor of the officially supported @typechain/hardhat.

Recent version of all three packages are compatible without peer dependency conflicts.

// packge.json
...
"@typechain/ethers-v5": "^10.1.0",
"@typechain/hardhat": "^6.1.2",
"typechain": "^8.1.0",
...
1
  • Thanks for the answer. I found using hardhat toolbox a much easier way to do stuff. So I have changed my package files now. Commented Feb 9, 2023 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.