Hi there could be various reasons behind this, you should consider checking the following
- npm version conflicts. Make sure that you have the right version of solc.
- File.sol was raw solidity smart contract, but you need to put Compiler Standard Input JSON into solc.compile()
- You have to specify what type of encoding is used for the solidity file.
code = fs.readFileSync('Voting.sol', 'utf8');