I had just finished editing what seems like the last of my error in my contracts because truffle will get to the last contract I have to compile, hangs for a second and the does this:

Compiling ./pathTo/x.sol...
Compiling ./pathTo/x.sol...
Compiling ./pathTo/x.sol...
    ast: standardOutput.sources[source_path].legacyAST,

TypeError: Cannot read property 'legacyAST' of undefined
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:90035:49
    at Array.forEach (native)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:90026:34
    at Array.forEach (native)
    at compile (/usr/lib/node_modules/truffle/build/cli.bundled.js:90023:26)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:90157:5
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:59075:7
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:59169:7
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:91073:16
    at next (/usr/lib/node_modules/truffle/build/cli.bundled.js:95365:18)

My truffle and solc versions are:

Truffle v3.4.9 (core: 3.4.8)
Solidity v0.4.15 (solc-js)

I have never seen 'legacyAST' referred to nor has searching it returned any results. Has any else experienced this or knows what may be the cause?


That property was required by SOLC compilers lower or equal to version 0.4.8 as it is explained at this Truffle Github issue

Modify your solidity code and the truffle-config.json to use at least version 0.4.9.

I hope that answer solves your problem. It did to me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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