truffle-box / tutorialtoken-box

A box containing all you need to get started with our OpenZeppelin (TutorialToken) tutorial.
MIT License
56 stars 23 forks source link

Tutorial is deprecated, needs to be updated #20

Open pynchmeister opened 4 years ago

pynchmeister commented 4 years ago

Going through the tutorial yesterday as a learning resource, I ran into several issues. I will revisit this issue when I have a moment and describe all that failed.

HaymanLiron commented 4 years ago

I can leave details

npm install -g truffle truffle version

Output: Truffle v5.1.41 (core: 5.1.41) Solidity v0.5.16 (solc-js) Node v14.4.0 Web3.js v1.2.1

truffle unbox tutorialtoken Then when I compile, I get this error:

Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragma solidity ^0.4.24".

I tried to fix it by changing the solc compiler version, but this caused other bugs. I am new to all of this so I'm not really sure how to fix it. If I do fix it then I can open a pull request.

HaymanLiron commented 4 years ago

OK the following two changes made it work for me:

Firstly, make sure that you are not using the latest version of openzeppelin-solidity For example, install version 2.x npm install openzeppelin-solidity@2.0

Secondly, make sure that solc version is in the 0.4.x range Do this by editing the truffle.js file and adding the following section:


compilers: {
    solc: {
      version: "^0.4.0", 
      parser: "solcjs"  
    }
 } 
HaymanLiron commented 4 years ago

@pynchmeister please let me know if these helps you

pynchmeister commented 4 years ago

Hello @HaymanLiron thanks for the suggestions. I did as you advised and I am still receiving an error after running truffle compile:

TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` cannot be used in the REPL