remix-project: invalid member of stdlib

screenshot 34 screenshot 35 when i am trying to run ‘node compile.js’ it its showing " (node:10152) V8: C:\Users\Akash\chat\node_modules\solc\soljson.js:3 Invalid asm.js: Invalid member of stdlib " and even when i run ’ npm run test ’ its showing an error " PS C:\Users\Akash\chat> node compile.js (node:10152) V8: C:\Users\Akash\chat\node_modules\solc\soljson.js:3 Invalid asm.js: Invalid member of stdlib PS C:\Users\Akash\chat> npm run test

chat@1.0.0 test C:\Users\Akash\chat mocha

(node:1432) V8: C:\Users\Akash\chat\node_modules\solc\soljson.js:3 Invalid asm.js: Invalid member of stdlib inbox 1) “before each” hook for “deploys a contract”

0 passing (115ms) 1 failing

  1. “before each” hook for “deploys a contract”: TypeError: (intermediate value).deploy(…).sent is not a function at Context.beforeEach (test\inbox.test.js:17:4)

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! chat@1.0.0 test: mocha npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the chat@1.0.0 test script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Akash\AppData\Roaming\npm-cache_logs\2018-12-29T20_20_39_579Z-debug.log PS C:\Users\Akash\chat> "
Can anyone give me a solution?

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 34 (7 by maintainers)

Most upvoted comments

Hey guys, for me changing the solidity compiler version solved the issue. I arbitrarily picked: npm install solc@0.4.26

HEY guys I was able to figure out the issue for myself. Basically use node version 10.0.0 If this doesnt work then you prolly have a typo. But to use an old version of node , i first installed NVM-node version manager. Once you download that, on your terminal you can run “nvm use 10”. Just like that, that means you are trying to use node version 10. nvm should notify you that you are veriosn 10, after that u r good. if you get into trouble, message me at my webstie mandodev.com

install specific version 12 helped me: sudo pacman -Sy “nodejs=12.18.3”

Contract Inbox.sol pragma solidity ^0.4.25;

contract Inbox{ string public message;

function Inbox(string initialMessage) public{
    message = initialMessage;
}
function setMessage(string newMessage) public{
    message = newMessage;
}    

}

compile.js code

const path = require(‘path’); const fs = require(‘fs’); const solc = require(‘solc’);

const inboxPath = path.resolve(__dirname,‘contracts’, ‘Inbox.sol’); const source = fs.readFileSync(inboxPath,‘utf8’); //console.log(solc.compile(source, 1)); //To see the log in cmd

module.exports = solc.compile(source, 1).contracts[‘:Inbox’];

When i run in cmd no error but after exporting getting this error message

(node:17691) V8: /smartcontract/inbox/node_modules/solc/soljson.js:3 Invalid asm.js: Invalid member of stdlib

mocha ganache-cli@latest and web3 are latest version

After trying a million different things to fix this error (reinstalling node_modules, re-cloning projects, playing with mocha/solc versions), I found that updating my Node.js version from 11.x to 12.2 (the current stable version as of May 17, 2019) did the trick. Running on MacOS 10.14 Mojave.