During solidity (solc) 0.5 releases the different frameworks like solc, truffle, web3, openzeppelin had a timeframe where some had a 0.5 compatible version released and some didn't. I think you could have changed specified the solc version like here (didn't try that) but meanwhile all of the mentioned fully support 0.5 (openzeppelin since 2 days ago at time of writing).
Consider doing the following
npm outdated
npm install [my-outdated-package] #repeat for all outdated packages
rm -R -f build #cleanup step (might not be necessary)
rm -R -f node_modules #cleanup step (might not be necessary)
npm install
truffle compile #(will still fail)
Check with truffle version
in a terminal window at some other place (not project dir) if it matches the current release here otherwise do this:
npm uninstall -g truffle
npm install truffle
Usually you should avoid installing global packages but e.g. BlockCatIO/solidity-flattener requires that solc is installed globally because of certain features (installation described here). Remember to upgrade that one too.
When you then run truffle-compile you should still see errors because they changed the syntax of pragma (found that here).
So change:
#old
pragma solidity ^0.4.20;
#new
pragma solidity >=0.4.20;
I also recommend upgrading ganache-cli (I had problems running the tests with old version):
npm install -g ganache-cli
You might then still see compile errors but that's what makes v0.5 great because they made some improvements you should troubleshoot one-by-one
Here the Breaking Changes in Solidity 0.5.0
Doing this I got it compiling again :)
Current version of open-zeppelin (2.0.0) relies on solc version 0.4.24.
Current version of truffle (5.0.0) relies on solc version 0.5.0.
Between solc 0.4.x and solc 0.5.x there are breaking changes.
Previous version of truffle (4.1.14) relies on solc version 0.4.24.
So in order to use open-zeppelin in conjunction with truffle, set in your package.json
file:
"devDependencies": {
"truffle": "4.1.14",
"openzeppelin-solidity": "2.0.0",
...
}
Alternatively, in truffle 5.0.0 onward, you can choose the desired version of solc.
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"
}
}
See more details in Truffle 5.0.0 release notes for how to bring your own compiler.
Best Answer
I managed to solve this by uninstalling and reinstalling nvm and node and then uninstalling and reinstalling truffle@beta. It could be that for some reason something was installed wrong (or didn't work with a later version) therefore creating the problem.