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.

Provided install instruction doesn't works

See original GitHub issue
  • Installing: npm install --save-dev eth-gas-reporter
  • Updating truffle.js:
    mocha: {
     reporter: 'eth-gas-reporter',
     reporterOptions: {
       currency: 'USD',
       gasPrice: 10
  • Starting test that call single contract method (contract is not abstract or empty): npm test


TypeError: Cannot read property 'gasUsed' of undefined
    at (/home/alp/proj/coinbet/smartcontracts/node_modules/eth-gas-reporter/gasStats.js:396:52)
    at Array.forEach (<anonymous>)
    at files.forEach.file (/home/alp/proj/coinbet/smartcontracts/node_modules/eth-gas-reporter/gasStats.js:371:11)
    at Array.forEach (<anonymous>)
    at Object.mapMethodsToContracts (/home/alp/proj/coinbet/smartcontracts/node_modules/eth-gas-reporter/gasStats.js:367:9)
    at Runner.Gas.runner.on (/home/alp/proj/coinbet/smartcontracts/node_modules/eth-gas-reporter/index.js:119:65)
    at emitNone (events.js:111:20)
    at Runner.emit (events.js:208:7)
    at start (/home/alp/proj/coinbet/smartcontracts/node_modules/mocha/lib/runner.js:826:10)
    at (/home/alp/proj/coinbet/smartcontracts/node_modules/mocha/lib/runner.js:854:5)
    at (/home/alp/proj/coinbet/smartcontracts/node_modules/mocha/lib/mocha.js:572:17)
    at /home/alp/proj/coinbet/smartcontracts/node_modules/truffle/build/webpack:/packages/truffle-core/lib/test.js:125:1
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! Test failed.  See above for more details.

Some internals of call:



OS: Linux Mint 18 Node: 8.11.3 Truffle: 4.1.14 Ganache-cli: 6.1.8

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

fodisicommented, Feb 27, 2020

I just ran into this issue. My local environment is: OS: Ubuntu 18.04.4 LTS 64-bit Truffle v5.1.14 (core: 5.1.14) Solidity - 0.5.16 (solc-js) Node v10.19.0 Web3.js v1.2.1 eth-gas-reporter 0.2.15

The issue happened after I deleted a couple of contracts and removed them from my migration script file.

After some investigation, I noticed in file gasData.js the call to the method .getContractNames(file) (line 43) was still returning the name of one of the deleted files, and when trying to process it, it would throw this error (it couldn’t get a valid receipt for the invalid transactionHash, which was not null - but probably some stale value).

I identified that my folder build/contracts still contained the ABI .json files for the deleted contracts. So as a workaround, I delete the entire build/contracts/ folder and run truffle compile --all to recompile the contracts.

It fixed the issue for me. Not sure why this was important, but maybe something related to inheritance between existing and deleted contracts ( 🤔 ❓ ).

PS: After I fixed it, I tried to reproduce the issue again but couldn’t. I’ll try again when I have some spare time and if I’m able to reproduce it, I’ll try to submit a PR with a fix or at least, open another issue with more specific details on how to reproduce it.

cgeweckecommented, Feb 27, 2020

@fodisi Thanks for analyzing this!

it couldn’t get a valid receipt for the invalid transactionHash, which was not null - but probably some stale value

Yes, I wonder if a simple remedy might be to wrap some of this logic in a try/catch and ignore stale deployments…

I’m going to open this as a separate issue so it doesn’t get lost…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to troubleshoot Windows Installer errors - Microsoft Support
Click Start windows icon · At the command prompt, type MSIExec, and then press Enter. · If the MSI engine is working, you...
Read more >
Install Windows 10 on your Mac with Boot Camp Assistant
Use the Boot Camp installer in Windows​​ Follow the onscreen instructions to install Boot Camp and Windows support software (drivers). You will ...
Read more >
Nest Power Connector - Google Nest Help
Use a helper if possible and avoid installing the device when home alone. Basic installation guide. The Nest Power Connector comes with instructions...
Read more >
Software & Installation Instructions - IDHS - Illinois
ROCS Version 6.13 is available for 64-bit operating systems like Windows 10 Professional only. HOME PREMIUM versions of Windows operating systems are NOT...
Read more >
Installation Guide - BTAWiki - Battletech Advanced 3062
BTA3062 IS NOT COMPATIBLE WITH THE XBOX GAME PASS VERSION OF ... the BattleTech Advanced 3062 Installer from the link provided above.
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 Post

No results found

github_iconTop Related Hashnode Post

No results found