# Error while I am compiling the contract using node

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


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.

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.

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