cgewecke / hardhat-gas-reporter

Gas Usage Analytics for Hardhat
MIT License
411 stars 57 forks source link

TypeError: Class extends value undefined is not a constructor or null #245

Closed schrute08 closed 2 weeks ago

schrute08 commented 2 weeks ago

Hi Team, I'm a bit amateur to TS, but I do write solidity and work my way around with hardhat, lately, I've been encountering an error that has given me a lot of pain. The error stack goes like this:

TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/**********/node_modules/hardhat-gas-reporter/src/lib/provider.ts:11:42)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .js] (*********/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (**********/node_modules/hardhat-gas-reporter/src/index.ts:16:1)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)

So I went on to the provider.ts file which has:

Screenshot 2024-09-30 at 11 47 14 PM

So I changed the path to: import { ProviderWrapper } from "hardhat/internal/core/providers/wrapper";

But still on running npx hardhat compile I'm getting the same error, I've cleaned the cache as well, but same output again. Would someone be able to help me out here?

cgewecke commented 2 weeks ago

@schrute08 Could you show your package.json, typescript config and hardhat config so I can see how your project is setup and all the versions you're using?

schrute08 commented 2 weeks ago

Yes @cgewecke , here: https://gist.github.com/schrute08/c830e1e2b29dafc8209a0743d41cc97d

cgewecke commented 2 weeks ago

@schrute08 Could you see if this problem resolves by updating hardhat to a more recent version? (Like 2.22.10?)

The minimum version supported by this plugin is 2.16.0 and your package has 2.12.4

https://github.com/cgewecke/hardhat-gas-reporter/blob/147367f650e857a2d92dea7b109bde6f443a7bcb/package.json#L74-L76

schrute08 commented 2 weeks ago

Ohh great...Thanks @cgewecke It got resolved!!