'(Invalid asm.js: Invalid member of stdlib) while trying to compile solidity 0.4.17
(Invalid asm.js: Invalid member of stdlib) while trying to compile solidity 0.4.17
(Invalid asm.js: Invalid member of stdlib) while trying to compile solidity 0.4.17
(Invalid asm.js: Invalid member of stdlib) while trying to compile solidity 0.4.17
const path = require('path');
const fs = require('fs-extra');
const solc = require('solc');
const buildPath = path.resolve(__dirname, 'build');
fs.removeSync(buildPath);
const contractPath = path.resolve(__dirname, 'contracts', 'Campaign.sol');
const source = fs.readFileSync(contractPath, 'utf8');
const output = solc.compile(source, 1).contracts;
fs.ensureDirSync(buildPath);
for (let contract in output) {
fs.outputJsonSync(
path.resolve(buildPath, contract.replace(':', '') + '.json'),
output[contract]
);
}
Solution 1:[1]
You may be hitting the same problem that affects the 0.4.25 binary: asm.js build of soljson 0.4.25 fails on node.js 14+ #537.
Unfortunately I don't know what is the cause but if it's the same problem then simply downloading the wasm binary will solve it: emscripten-wasm32/solc-emscripten-wasm32-v0.4.17+commit.bdeb9e52.js.
The wasm binaries should also be faster than the asm.js ones so I recommend always using them.
Solution 2:[2]
Had the same issue, what solved it for me was changing version of the solidity compiler. I picked it arbitrarily tbh, and worked. I typed in the console:
npm install [email protected]
Solution 3:[3]
The problem is there is no contract result in output(const of solc compiler).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | cameel |
| Solution 2 | Robert |
| Solution 3 | Omar Jabban |
