TypeChain icon indicating copy to clipboard operation
TypeChain copied to clipboard

Cannot find module 'typechain/dist/TypeChain'

Open Tinalst opened this issue 5 years ago • 7 comments

'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"
  }

Tinalst avatar Jun 23 '21 03:06 Tinalst

Can you please send a minimal reproduction repo or full repro instructions?

quezak avatar Jun 23 '21 09:06 quezak

@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'
  ]
}


incrypto32 avatar Jun 23 '21 11:06 incrypto32

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.

incrypto32 avatar Jun 23 '21 11:06 incrypto32

Yes. hardhat-typechain was migrated to this repo. There is a deprecation note on the repo i believe.

krzkaczor avatar Jun 23 '21 11:06 krzkaczor

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

incrypto32 avatar Jun 23 '21 11:06 incrypto32

Oh, good to know. I will repoen this issue to remember to send PR to HH docs.

krzkaczor avatar Jun 23 '21 11:06 krzkaczor

Related: https://github.com/nomiclabs/hardhat/pull/1739

krzkaczor avatar Jul 31 '21 19:07 krzkaczor