Hi guys. I have got one big problem. When i try to compile my code i'm getting some kind of unusuall error. I think everything is ok but when i try to "node compile.js" my main file ("inbox.sol") everytime i'm getting same error:

"'inbox.sol:1:1: Parser## Heading ##Error: Expected pragma, import directive or contract/interface/library definition.\npragma solidity ^0.5.10;\r\n^\n',"

I will past there my code and exactly what solidity complier says.

Compile.js file compile.js file Inbox.sol file

inbox.sol file

Console and error Console and error

You are my only hope guys. Please help me.

2 Answers 2


The reason for that is because your solc-js compiler version is lower than 0.5.11 but you want the version of your contract to be higher than 0.5.11 so the compiler give error.

A simple way to solve this is change pragma solidity ^0.5.11 to pragma solidity ^0.5.0 or just update your solc-js compiler with npm install solc


I've uptated my solc and i changed my pragma version to ^0.5.0 Nothing get changed :/

enter image description here

  • try using change ^0.5.0 to >=0.4.0 < 0.6.0
    – haxerl
    Commented Aug 23, 2019 at 1:24
  • Can you update if it work or not?
    – haxerl
    Commented Aug 24, 2019 at 11:17
  • You know what?! It just has started to work. I dont know why. It even didnt need any changes.
    – MrRav3n
    Commented Aug 25, 2019 at 16:29

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.