hardhat-gas-reporter icon indicating copy to clipboard operation
hardhat-gas-reporter copied to clipboard

hardhat test fails with TypeError: nativeNC failed when hardhat-gas-reporter enabled

Open aczire opened this issue 1 year ago • 2 comments

Regardless of what ever I tried, hardhat-gas-reporter fails always with nativeNC failed exception. Made sure there is no eth-gas-reporter installed, and my hardhat config has only enabled: true , and removed all other options like coinmarketcap, currency, token etc. to ensure they are not causing the exception.

The tests passes successfully (with network localhost and hardhat) if I comment out or remove require("hardhat-gas-reporter"), so tests are not the problem. Tried with networks, hardhat, localhost, testnets (rinkeby, goerli), nothing helped.

Any help is much appreciated.

$ npx hardhat test --network localhost An unexpected error occurred:

TypeError: nativeNC failed:

at createInvalidReporterError (D:\development\carbon\cct\node_modules\mocha\lib\errors.js:207:13)
at Mocha.reporter (D:\development\carbon\cct\node_modules\mocha\lib\mocha.js:343:17)
at new Mocha (D:\development\carbon\cct\node_modules\mocha\lib\mocha.js:196:6)
at SimpleTaskDefinition.action (D:\development\carbon\cct\node_modules\hardhat\src\builtin-tasks\test.ts:95:21)
at Environment._runTaskDefinition (D:\development\carbon\cct\node_modules\hardhat\src\internal\core\runtime-environment.ts:219:14)
at Environment._runTaskDefinition (D:\development\carbon\cct\node_modules\hardhat\src\internal\core\runtime-environment.ts:219:14)
at Environment.run (D:\development\carbon\cct\node_modules\hardhat\src\internal\core\runtime-environment.ts:131:14)
at SimpleTaskDefinition.action (D:\development\carbon\cct\node_modules\hardhat\src\builtin-tasks\test.ts:159:28)
at Environment._runTaskDefinition (D:\development\carbon\cct\node_modules\hardhat\src\internal\core\runtime-environment.ts:219:14)
at Environment._runTaskDefinition (D:\development\carbon\cct\node_modules\hardhat\src\internal\core\runtime-environment.ts:219:14) {

code: 'ERR_MOCHA_INVALID_REPORTER', reporter: 'D:\development\carbon\cct\node_modules\eth-gas-reporter\index.js' }

$ npm list | grep gas-report

├── [email protected]

$ npm list -g | grep gas-report

├── [email protected]

aczire avatar Aug 15 '22 13:08 aczire

I got a similar error message! Did you find any solution?

qorbani avatar Oct 12 '22 04:10 qorbani

+1 [ERR_MOCHA_INVALID_REPORTER](code: 'ERR_MOCHA_INVALID_REPORTER',)

huaigu avatar Oct 12 '22 07:10 huaigu

Never got it working. It's working in vm. So seems that's the only workaround for me now.

aczire avatar Oct 17 '22 09:10 aczire

Same issue for me, node 16.18.0. MacOS. Works fine same repo for Ubuntu 20 same node version.

NatPDeveloper avatar Mar 30 '23 14:03 NatPDeveloper

Am testing in Node 16 locally on a Mac and it's fine. This may have self-resolved. Please ping if anyone continues to run into it.

cgewecke avatar Jan 31 '24 02:01 cgewecke