TypeChain: Error: Couldn't find ethers-v5
I am getting this error after trying to generate typechain files out of my artifacts:
Error: Couldn't find ethers-v5. Tried loading: @typechain/ethers-v5, typechain-target-ethers-v5, C:\Users\oxman\Code\defi\keep3r\keep3r-v2\ethers-v5.
Perhaps you forgot to install @typechain/ethers-v5?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 23 (10 by maintainers)
Adding
"*": ["node_modules/*"]
totsconfig.json
fixes it.https://github.com/dividab/tsconfig-paths/issues/88
I am leaning towards changing the default output directory to
typechain-types
to avoid this issue in the future.@krzkaczor Are you sure this is resolved? I am still seeing the same issue. After much trial and error, the only thing which fixed it for me was:
I found it was essential to stop @typechain/hardhat getting hoisted.
Interestingly that issue is still happening even with this set in
paths
:I thought that this would force
tsconfig-paths
to look for the@typechain/ethers-v5
package innode_modules
, but it didn’t do that.The only solution that worked was
"*": ["node_modules/*"]
.Update: Yeeaah… doing that made TypeChain work but broke my tests, which I run with Hardhat:
I think I will opt out of using
paths
for the time being.@kiwi745 Great catch! Exactly my problem. You saved me a lot of debugging. They should update the docs with this information.
Should I add this folder (
typechain-types
) to the.gitignore
file?@jchayan can u dump your package.json here? make sure that all versions are up-to-date. If this still doesn’t work and u use waffle uninstall it tmp.