2

This question already has an answer here:

Trying to use Solidity v0.5.0 with Truffle. Starting v5.0.0 Truffle allows setting solc version in truffle.js, as per its docs

I tried both native

    compilers: {
        solc: {
            version: "native"
        }
    }

with

$ solc --version
solc, the solidity compiler commandline interface
Version: 0.5.0+commit.1d4f565a.Linux.g++

and solc-js v0.5.0

    compilers: {
        solc: {
            version: "0.5.0"
        }
    }

all that with Truffle v5:

$ truffle version
Truffle v5.0.0-beta.1 (core: 5.0.0-beta.1)
Solidity v0.4.25 (solc-js)

v0.4.25 here is its default packed solc-js version, not what I use in the project.

But even an empty sample contract

pragma solidity ^0.5.0;

contract Sample {
    constructor() internal {}
}

fails to compile:

$ truffle compile
TypeError: Error parsing /path/to/project/contracts/Sample.sol: solc.compileStandard is not a function
    at Object.parseImports (/home/etsvigun/.nvm/versions/node/v10.13.0/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/parser.js:49:1)
    at Object.getImports (/home/etsvigun/.nvm/versions/node/v10.13.0/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:332:1)
    at Promise.all.then.results (/home/etsvigun/.nvm/versions/node/v10.13.0/lib/node_modules/truffle/build/webpack:/packages/truffle-compile/profiler.js:305:1)

Is there a way to use Solidity v0.5.0 with Truffle already, or doesn't that work yet?

marked as duplicate by Aquila, shane, Richard Horrocks, Achala Dissanayake, eth Nov 18 '18 at 0:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

I haven't actually tried what you're doing, but I noticed a possible misinterpretation of the linked docs. Maybe it will help.

If I'm not mistaken, their "native" is bundled with truffle, and the syntax you used for solc-js v0.5.0 is for docker containers that I don't think you are using.

Did you try?:

// Relative or absolute path to an npm installed solc-js
compilers: {
  solc: {
    version: "/Users/axic/.nvm/versions/node/v8.9.4/lib/node_modules/solc"
  }
}

Obviously, the path needs to point to your installed location of the actual binary.

Hope it helps.

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