Cannot find module 'typechain/dist/TypeChain'
'typechain/dist/TypeChain' doesn't exist in typechain(version 5.0.0) library.
My package.json list as follow:
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@typechain/ethers-v5": "^7.0.1",
"@types/chai": "^4.2.19",
"@types/mocha": "^8.2.2",
"@types/node": "^15.12.4",
"chai": "^4.3.4",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.3.1",
"hardhat": "^2.4.0",
"hardhat-gas-reporter": "^1.0.4",
"hardhat-typechain": "^0.3.5",
"ts-generator": "^0.1.1",
"ts-node": "^10.0.0",
"typechain": "^5.0.0",
"typescript": "^4.3.4"
}
Can you please send a minimal reproduction repo or full repro instructions?
@quezak Im facing the same issue.. Just compile this repo
→ npx hardhat compile
Solidity 0.8.4 is not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.
Learn more at https://hardhat.org/reference/solidity-support"
Nothing to compile
Creating Typechain artifacts in directory typechain for target ethers-v5
An unexpected error occurred:
Error: Cannot find module 'typechain/dist/TypeChain'
Require stack:
- /home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat-typechain/dist/src/index.js
- /home/incrypto/dev/blockchain/hardhat-tut/hardhat.config.ts
- /home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat/internal/core/config/config-loading.js
- /home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat/internal/cli/cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
at Function.Module._load (node:internal/modules/cjs/loader:773:27)
at Module.require (node:internal/modules/cjs/loader:1012:19)
at require (node:internal/modules/cjs/helpers:93:18)
at /home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat-typechain/src/index.ts:46:29
at OverriddenTaskDefinition._action (/home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat-typechain/src/index.ts:46:29)
at Environment._runTaskDefinition (/home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at main (/home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat/src/internal/cli/cli.ts:188:5) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat-typechain/dist/src/index.js',
'/home/incrypto/dev/blockchain/hardhat-tut/hardhat.config.ts',
'/home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat/internal/core/config/config-loading.js',
'/home/incrypto/dev/blockchain/hardhat-tut/node_modules/hardhat/internal/cli/cli.js'
]
}
Ok this issue was because i still used the 'hardhat-typechain' which is no longer maintained i guess the new official one is @typechain/hardhat . I see that @Tinalst also uses this one.
Yes. hardhat-typechain was migrated to this repo. There is a deprecation note on the repo i believe.
Yes. hardhat-typechain was migrated to this repo. There is a deprecation note on the repo i believe.
@krzkaczor but the hardhat documentation still mentions the old package that's what's misleading people
Oh, good to know. I will repoen this issue to remember to send PR to HH docs.
Related: https://github.com/nomiclabs/hardhat/pull/1739