简体   繁体   中英

how to solve type error in solidity Remix

my solidity smart contract is compiling in remix with out any error . my contract code is below:

   pragma solidity >=0.4.0 <0.6.0;
   contract NewConreact {
     uint storedData;

     function set(uint x) public {
        storedData = x;
     }

    function get() public view returns (uint) {
        return storedData;
    }
}

it is compiling in remix perfectly but when i run it to triger set() and get()i got:

"error: Failed to decode output: TypeError: Cannot read property 'length' of undefined"

this error.

I found a closed issue in solidity git repo but didn't find any solution. I also increase the gas limit but didn't work.

somebody, please help me to figure out the problem.

This normally happens when the deployment is failing with unknown reasons - may be you tried with Injected web3 or web3 provider like Ganache-cli and it somehow failed deployment and however the contract interface was still appended to the UI. This could have made you confuse that the contract got deployed correctly.

The work around is to view and expand the log output of the transaction for deploying the contract. Make sure your contract is successful before doing transactions.

Please provide your logs if you are still unable to do the transactions even after you have deployed the contract successfully.

Try using Chrome, avoid Safari, and be sure to remove the "s" from the solidity Remix site > won't work > https://remix but http://remix will. Once I moved to Chrome it worked

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM