I am following this course from Stephen Grider, learning Solidity. I cam unable to use compile.js to compile solidity. I am using node.js version 12.18.3. solc version 0.4.25 and npm version 6.14.16.
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');
module.exports = solc.compile(source, 1).contracts[':Inbox'];
Inbox.sol code:
pragma solidity ^0.4.25;
contract Inbox {
string public message;
function Inbox(string initialMessage) public {
message = initialMessage;
}
function setMessage(string newMessage) public {
message = newMessage;
}
}
This is the full error:
RangeError: Maximum call stack size exceeded
at Object.$db [as dynCall_viiiiii] (C:\Users\iluka\Desktop\Solidity\Inbox\no
de_modules\←[4msolc←[24m\soljson.js:12:120931)
at invoke_viiiiii (C:\Users\iluka\Desktop\Solidity\Inbox\node_modules\←[4mso
lc←[24m\soljson.js:1:1118207)
at Array.pva (C:\Users\iluka\Desktop\Solidity\Inbox\node_modules\←[4msolc←[2
4m\soljson.js:13:29030)
at Object.M9a [as dynCall_vi] (C:\Users\iluka\Desktop\Solidity\Inbox\node_mo
dules\←[4msolc←[24m\soljson.js:12:99033)
at invoke_vi (C:\Users\iluka\Desktop\Solidity\Inbox\node_modules\←[4msolc←[2
4m\soljson.js:1:1115011)
at Array.xta (C:\Users\iluka\Desktop\Solidity\Inbox\node_modules\←[4msolc←[2
4m\soljson.js:10:704784)
at Object.Dfb [as dynCall_iii] (C:\Users\iluka\Desktop\Solidity\Inbox\node_m
odules\←[4msolc←[24m\soljson.js:12:130740)
at invoke_iii (C:\Users\iluka\Desktop\Solidity\Inbox\node_modules\←[4msolc←[
24m\soljson.js:1:1119442)
at Array.vta (C:\Users\iluka\Desktop\Solidity\Inbox\node_modules\←[4msolc←[2
4m\soljson.js:10:703080)
at Object.Yfb [as dynCall_iiiiii] (C:\Users\iluka\Desktop\Solidity\Inbox\nod
e_modules\←[4msolc←[24m\soljson.js:12:131900)