question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting type error when running hardhat compile

See original GitHub issue

I’m relatively new to Typescript but not so much ethers, have been using it + hardhat & waffle for a bit now. I was refactoring an older codebase to TS to learn & I quickly figured out I needed typechain to save my sanity (it’s truly awesome btw).

I’ve read the docs & everything seems to be straightforward, I’ve installed the correct packages & versions per the examples given. However, I keep running into this error when running hardhat compile:

TypeError: (0 , typechain_1.glob) is not a function

I’ve tried uninstalling & reinstalling everything (saw somewhere that someone fixed this by reinstalling waffle after typechain so tried that as well) and I just can’t seem to get it to work after a few hours of debugging.

Dev dependencies are here:

"devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.4",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "@typechain/hardhat": "^4.0.0",
    "@types/node": "17.0.8",
    "@types/react": "17.0.38",
    "autoprefixer": "^10.4.2",
    "chai": "^4.3.4",
    "eslint": "8.6.0",
    "eslint-config-next": "12.0.8",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.5.3",
    "hardhat": "^2.8.2",
    "postcss": "^8.4.5",
    "tailwindcss": "^3.0.18",
    "typechain": "^4.0.1",
    "typescript": "4.5.4"
  }

Any help would be greatly appreciated, thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
0xGenghisGoosecommented, Mar 1, 2022

Boom! Updating the typechain & @typechain/ethers-v5 got it done for me. Very interesting, it would appear that when spinning up the hardhat project & installing the usual dependencies (namely Waffle), Waffle is using a super old version of Typechain that will also cause dependency tree errors if not updated manually.

Thank you @krzkaczor !! I really appreciate it man, will make sure to check for these older versions getting snuck in there moving forward

0reactions
krzkaczorcommented, Mar 1, 2022

@0xGenghisGoose np. I am gonna pressure waffle team to move typechain to peer dep and bump it. It should fix this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hardhat errors | Ethereum development environment for ...
#Hardhat errors. This section contains a list of all the possible errors you may encounter when using Hardhat and an explanation of each...
Read more >
Sometimes when i run `npx hardhat compile` i get this error ...
Sometimes when i run this command npx hardhat compile on my windows cli i get the error below: Compiling 72 files with 0.7.0 ......
Read more >
I keep getting this error while trying to compile my contract ...
The error message clearly indicates that your contract expects no argument as a constructor. Try const transactions = await ...
Read more >
Sometimes when I run `npx hardhat compile` I get this error ...
Sometimes when I run this command npx hardhat compile on my windows cli I get the error below: Compiling 72 files with 0.7.0 ......
Read more >
How to create and deploy a smart contract with Hardhat
1. Ethereum development environments like Truffle and Hardhat make it easier to work with smart contract... 2. Hardhat is a development environment that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found