0
saitejas-MacBook-Air:Inbox saitejakuruva$ sudo node compile.js assert.js:340
throw err;
^

AssertionError [ERR_ASSERTION]: Invalid callback specified. at wrapCallback (/Users/saitejakuruva/node_modules/solc/wrapper.js:16:5) at runWithReadCallback (/Users/saitejakuruva/node_modules/solc/wrapper.js:42:26) at compileStandard (/Users/saitejakuruva/node_modules/solc/wrapper.js:83:14) at Object.compileStandardWrapper (/Users/saitejakuruva/node_modules/solc/wrapper.js:90:14) at Object. (/Users/saitejakuruva/Documents/Inbox/compile.js:6:18) at Module._compile (internal/modules/cjs/loader.js:799:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10) at Module.load (internal/modules/cjs/loader.js:666:32) at tryModuleLoad (internal/modules/cjs/loader.js:606:12) at Function.Module._load (internal/modules/cjs/loader.js:598:3)

I have faced the above error when I am trying to compile a simple solidity contract.I am also providing the link of the code that I have written for compiling the contract.

https://i.sstatic.net/OAxMy.png Please help me out asap.

0

1 Answer 1

0

The problem is with the second parameter of solc.compile here:

console.log(solc.compile(source,1));

The second parameter should be a function or should be omitted. If your smart contract source file does not import other source files, try removing the second parameter like this:

console.log(solc.compile(source));

See documentation for details.

2
  • But it's just saying that I have only 1 contract in my contracts directory that have to be compiled .
    – Sai Teja
    Commented Mar 28, 2019 at 15:23
  • Check documentation. Second parameter may not be a number, it should either be a function or should be omitted. Commented Mar 28, 2019 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.