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.

Cannot destructure property `body` of 'undefined' or 'null' (5.1.10 to any later version)

See original GitHub issue

I’ve been using truffle with the same contract consistently for a while now (6 months easily). This latest upgrade 5.1.10 to 5.1.13 (I missed one) is the first time I’ve seen this error. Wondering if anyone else has.

Solution

Downgrading to 5.1.10 allows me to truffle migrate --network development without issue.


Issue

I’ve been using the same contract for 6+ months. After upgrading from 5.1.10 to 5.1.1x , I started getting this error when attempting to launch my contract on any network:

Cannot destructure property body of ‘undefined’ or ‘null’

Downgrading to 5.1.10 allows me to launch my contract again. Worked my way down from 5.1.13 to 5.1.10.

Steps to Reproduce

truffle migrate --network development or truffle migrate --network ropsten

Expected Behavior

My contract would compile and launch as expected.

Actual Results

√ Fetching solc version list from solc-bin. Attempt #1 Error: TypeError: Error parsing C:/Users/Mine/Projects/project/contracts/Contract.sol: Cannot destructure property body of ‘undefined’ or ‘null’. at Object.compile (C:\Users\Mine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\workflow-compile\legacy\index.js:80:1)

Environment

  • Operating System: Windows
  • Ethereum client:
  • Truffle version (truffle version): 5.1.13
  • node version (node --version): 12.15.0
  • npm version (npm --version): 6.13.7

Issue Analytics

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

github_iconTop GitHub Comments

6reactions
xlwwwwcommented, Apr 21, 2020

yes,this problem can be solved by npm install truffle@5.1.9 -g and then delete the build directory and re-compile and migrate the contract

6reactions
yinjinitcommented, Mar 4, 2020

Thanks @slmatthiesen and thanks you @CruzMolina . I had same issue using v5.1.15 and the old v5.1.10 solved my issue. Thanks again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot destructure property `body` of 'undefined' or 'null ...
I have the following error in the console: TypeError: Cannot destructure property body of 'undefined ...
Read more >
Cannot destructure property of 'undefined' or 'null, typeerror
All this means is that you are trying to access a property of an object that is undefined. These usually happens when we...
Read more >
React Typeerror: Cannot Destructure Property As It Is Undefined
Cannot destructure property body of 'undefined' or 'null ' (5.1.10 to any later Error: TypeError: Error parsing ...
Read more >
TypeError: Cannot destructure property '…' of 'Object ...
ReactJS Pass Functions through Context — TypeError: Cannot destructure property '…' of 'Object(…)(…)' as it is undefined. · Real reason of failure:.
Read more >
Cannot destructure Property of Undefined Error in JS
The "Cannot destructure property of undefined" error occurs when we try to destructure a property from a value that is equal to undefined...
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