无效的 asm.js:stdlib 成员无效

Alo*_*ari 6 solidity

(节点:7894)V8:/var/www/html/testeth/node_modules/solc/soljson.js:3无效的asm.js:stdlib的成员无效

我正在 ganache-cli 简单合约上进行测试部署,但它显示了该警告。请帮助解决该问题。

在“index.sol”的代码下面

pragma solidity ^0.4.17;

contract testalk{

string public message;

function testalk(string initialMsg) public {
    message = initialMsg;
}

function setMessage(string nwMsg) public {
    message = nwMsg;
}

}
Run Code Online (Sandbox Code Playgroud)

我正在使用“mocha”和 ganache-cli 提供程序对其进行测试,代码如下:-

const assert = require('assert');
const ganache = require('ganache-cli');
const Web3 = require('web3');

const web3 = new Web3(ganache.provider());

const { interface, bytecode} = require('../compile');

require('events').EventEmitter.defaultMaxListeners = 15;

let accounts;
let testeth;

beforeEach( async ()=>{

accounts = await web3.eth.getAccounts();

testeth = await new web3.eth.Contract(JSON.parse(interface))
                .deploy({data: bytecode, arguments: ['Hi Alok!']})
                .send({gas: '1000000',from: accounts['0']});

});

describe("testalk",() => {
it('deploy a contract', () =>{
    assert.ok(testeth.options.address);
});

it('get the message', async () => {
    const message = await testeth.methods.message().call();
    assert.equal('Hi Alok!', message);
    //console.log(message);
})

it('get the message', async () => {
    await testeth.methods.setMessage("Bye Alok!").send({from: accounts[0], gas: '1000000'});

    const message = await testeth.methods.message().call();
    console.log(message);

});

});
Run Code Online (Sandbox Code Playgroud)

我正在使用 Ubuntu 和 Nodejs。

Kha*_*med 0

发生这种情况的原因有很多。如果您使用的是 remix ide,那么默认情况下 asm 在 chrome 中被禁用,这可能是一个问题。您可能会以某种不兼容的方式使用旧的 Solidity 编译器。您的代码本身可能存在问题。除非您给出代码的所有细节、您使用的环境(如 IDE 和操作系统等),否则任何人都只能猜测最大值。