0

I installed zeppelin-solidity package using npm, to use the erc-721 contract.

But the problem is that when I use truffle compile, it gives the following error:

/Users/me/dev/myfolder/erc721/node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.24;
^----------------------^

Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragma solidity ^0.4.24".
Please update your truffle config or pragma statement(s).
(See https://truffleframework.com/docs/truffle/reference/configuration#compiler-configuration for information on
configuring Truffle to use a specific solc compiler version.)

Compilation failed. See above.

Some answers I saw are suggesting to bump up the pragma solidity to 0.5, but how can i change the version in an included file?

Also if this contract is old should i be using it, or are there better implementations of erc721 available?

UPDATE: I have tried changing the solc compiler as below, but still the error persists:

compilers: {
    solc: {
        version: "^0.4.24",
        //parser: "solcjs",
        optimizer: {
            enabled: true,
            runs: 200
        }
    }
  }
srinivas
  • 4,778
  • 2
  • 32
  • 43

1 Answers1

0

Write a file called truffle.js such as:

  module.exports = {
  // Configure your compilers
  compilers: {
    solc: {
      version: ">=0.4.24", // Fetch exact version from solc-bin (default: truffle's version)
    }
  },
};

and place it under the project root directory. That's it.

Read more about Truffle configurations: https://www.trufflesuite.com/docs/truffle/reference/configuration

Ferit
  • 8,692
  • 8
  • 34
  • 59