1

I want to run truffle compile on my AWS Ubuntu 18.4 server. I'm able to compile the same contracts on my local with no compilation errors but when I tried to run truffle compile on AWS ubuntu server it throws Syntax Errors.

Can someone please explain what's happening here? Do you think truffle version can be an issue here?

Local System: Truffle v4.1.14 (core: 4.1.14)

AWS Ubuntu Server: Truffle v5.0.1 (core: 5.0.1)

  • 1
    You're gonna have to share some more information here. What are the syntax errors? How do you install Truffle on your local machine? How do you install Truffle on the remote machine? – goodvibration Jan 8 at 11:48
  • 2
    BTW, Truffle 4.1.14 relies on solc 0.4.24, while Truffle 5.0.1 relies on solc 0.5.0. Between these two versions of solc there are breaking changes, meaning, you're very much likely to get compilation errors in the latter, but not in the former. – goodvibration Jan 8 at 11:49
2

Truffle 4.1.14 relies on solc 0.4.24.

Truffle 5.0.1 relies on solc 0.5.0.

Between these two versions of solc there are breaking changes, meaning that you're very much likely to get compilation errors in the latter, which you have not received in the former.

If you don't want to update your contracts to solc 0.5.x, but still be able to compile them with Truffle 5.x, then you can choose the desired version of solc in your Truffle configuration file.

For example, in order to configure truffle to use solc 0.4.24, add this in truffle-config.js:

compilers: {
    solc: {
        version: "0.4.24"
    }
}

This feature is available from Truffle 5.x onward (so don't try it on earlier versions).

See more details in Truffle 5.0.0 release notes for how to bring your own compiler.

2

This is probably an issue with Solidity compiler versions.

You can find out which version of Solidity compiler is used by your local Truffle using this post.

After that, I would advise you to set your compiler versions explicitly using Truffle configuration.

When your AWS compiler is in sync with your local compiler, you should be good to go.

  • P. S. It's a bit unrelated, but I would strongly recommend setting a specific compiler version in your source code - source. – Ivan Andrusenko Jan 8 at 11:55
  • 1
    Thanks! It worked. There are no compilation errors but found another error that says, "Error: spawn ENOMEM". Any idea? :/ – Gagan Jan 8 at 12:03
  • 1
    @Gagan This is most probably unrelated to Truffle itself, but to NodeJS and the system you run Truffle on. It could mean that there's no swap space enabled on your system. To follow the Stack Exchange guidelines, you should probably ask this question in a separate topic. – Ivan Andrusenko Jan 8 at 12:07
  • 1
    Yeah, you are absolutely right! After few changes it now says, "FATAL ERROR: NewSpace::Rebalance Allocation failed - process out of memory". And thanks, I'll put this in another post with details. – Gagan Jan 8 at 12:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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