This is the first contract with this Udemy course.
Trying to compile by running: "node compile.js" but get the following error:
iii@iii:~/inbox$ node compile.js
assert.js:350
throw err; ^
AssertionError [ERR_ASSERTION]: Invalid callback object specified.
at runWithCallbacks (/home/iii/Digital Ledger/inbox/node_modules/solc/wrapper.js:97:7)
at compileStandard (/home/iii/Digital Ledger/inbox/node_modules/solc/wrapper.js:207:14)
at Object.compileStandardWrapper [as compile] (/home/iii/Digital Ledger/inbox/node_modules/solc/wrapper.js:214:14)
at Object.<anonymous> (/home/iii/Digital Ledger/inbox/compile.js:9:6)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
This is my "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);
And the simple contract:
pragma solidity ^0.4.17;
contract Inbox {
string public message;
function Inbox(string iniMess) public {
message = iniMess;
}
function setMess(string newMess) public {
message = newMess;
}
}
And this is the file structure:
-inbox
-node_modules
-contracts
-inbox.sol
-package.json
-package-lock.json
-compile.js
Thank you for any help :)