This command worked on my iMac. Thank you gabba!
I am having issues changing the truffle compiler version to 0.5.12 as it is not in the list right now. I have tried using the link the error provides: https://www.trufflesuite.com/docs/truffle/reference/configuration#compiler-configuration
Cannot find the exact instructions to change the truffle compiler version. Please let me know where I should look exactly in the link or in this forum if it has been solved in a thread somewhere as I have tried scrolling through with no luck.
Please help!
Hi @Goosie
Let me share what I know. Here are the breakdown.
Ganache : it is only local blockchain (same as Javascript VM in remix) for testing your contract
Ethereum Testnet : if you are confident with your code already, the next layer of test will be testnet (Ropsten, Rinkeby, etc). You can use remix to deploy to testnet as well. But, definitely Truffle framework offers more configuration, more advanced.
Ethereum Mainnet : the final step deployment to the prod. env. the Ethereum Mainnet.
FYI, you can configure either connection to Ethereum testnet or mainnet. The easiest way I know is via Infura service. The more complex one is to host your own Ethereum node.
I hope it is helpful
@Yogalholic @Taha @TommyBrook I am having the same issue with the truffle compiler version change to 0.5.12
Did you guys figure it out? I have tried changing the truffle config file with no luck. Still get the same error. Please help if you have a solution.
Hello Filip,
I have a contract just like you did on the video, but when i hit the compile button, i get this;
Why am i not seeing my contract?
Hi @acf
Open the file truffle-config
and scroll till the bottom.
You will find something like:
solc: {
//version: "0.6.2", // Fetch exact version from solc-bin (default: truffle's version)
}
uncomment the version and add yours.
solc: {
version: "0.5.12", // Fetch exact version from solc-bin (default: truffle's version)
}
happy learning,
Dani
Hey @Ako1
Nothing wrong there, the contract is compiled.
You want to run truffle migrate --reset
happy coding,
Dani
Hi @dan-i really appreciate the reply however, I did try that and it does not work…
Any other suggestions?
Hey @acf,
The error message seems to be related to a mismatch between the compiler used and the solidity version declared in your pragma statements.
Based on the message, your contracts begin with pragma solidity 0.5.12;
while truffle is compiling using v 0.5.8
.
The compiler version is defined in the truffle-config file so it should work correctly if you change it to 0.5.12;
Also restart your local blockchain (specially if you are using ganache-cli).
If it still does not work would you mind to pull to github and share the link so that I can try to replicate the issue?
Keep me posted,
Dani
I am in the part of the course where ganache was just opened and quick setup used. I don’t think I ever connected it to truffle…
I am new to github but I have posted my Helloworld folder into the link: https://github.com/alricf/Helloworld-truffle-introduction.git
Please let me know if you require anything else and thanks for the help!
Hey @acf
Your truffle-config file is correctly set, but some things are missing.
- You do not have a migration file for your contract
Helloworld
. - There is a missing
:
after this statementstring message ="Hello World!"
Fix the two issues above and try to migrate again.
For the mig file you can use:
const Helloworld = artifacts.require("Helloworld");
module.exports = function(deployer) {
deployer.deploy(Helloworld);
};
Make sure that the migration file name starts with number 2
example: 2_mig.js
Let me know the result.
cheers,
Dani
The syntax to declare a function requires ()
.
function getMessage() public view returns (string memory) {}
cheers,
Dani
Thanks.
How doi update my truffle version from 0.5.0. to 0.5.12?
Hey @Ako1
You have to change the compiler version in your truffle-config file.
Open truffle-config and scroll till the bottom, you will find:
compilers: {
solc: {
// version: "0.5.12", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: "byzantium"
// }
},
},
``
Uncomment the version, write the one you would like to use and save.
Happy coding,
Dani
@filip I am having trouble running Ganache after linking truffle config file. After hit saving and restart it just going spinning endless loop. I was able to see the initial chain set up before linking the project The config file is the same as the code in class. What can I do ?
Hi Fillip ,
please advise to solve the below error :
:11:2: ParserError: Expected pragma, import di
rective or contract/interface/library definition.
}S
^
on truffle console , i write truffle migrate --reset
I’m having issues compiling when I use truffle compile in powershell
The error comes up with
“at Object.compile (C:\Users\Bob\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\workflow-compile\legacy\index.js:72:1)”
I changed the settings in the truffle-config.js to 0.5.12 in atom and still get the object compiler error.
compilers: {
solc: {
// version: “0.5.12”, // Fetch exact version from solc-bin (default: truffle’s version)
Thank you.