hardhat solidity不同版本,不能正常编译

hardhat.config.js

compilers: [
      {
        version: "0.7.0"
      },
      {
        version: "0.7.3"
      },
      {
        version: "0.8.0"
      },
      {
        version: "0.8.1"
      },
    ]
  },

编译时异常提示

npx hardhat compile Solidity 0.8.0, 0.8.1 are not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.

Learn more at https://hardhat.org/reference/solidity-support"

Error HH606: The project cannot be compiled, see reasons below.

These files import other files that use a different and incompatible version of Solidity:

  • @soliditylabs/erc20-permit/contracts/ERC20Permit.sol (^0.7.0) imports @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.8.0) and @openzeppelin/contracts/utils/Counters.sol (^0.8.0)

These files depend on other files that use a different and incompatible version of Solidity:

  • contracts/ERC20PermitToken.sol (^0.7.0) depends on @openzeppelin/contracts/token/ERC20/ERC20.sol (^0.8.0), @openzeppelin/contracts/utils/Counters.sol (^0.8.0) and 2 other files. Use --verbose to see the full list.

To learn more, run the command again with --verbose

Read about compiler configuration at https://hardhat.org/config

For more info go to https://hardhat.org/HH606 or run Hardhat with --show-stack-traces

请先 登录 后评论

2 个回答

Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
Yee - CTO
请先 登录 后评论
  • 1 关注
  • 0 收藏,903 浏览
  • 比特聪 提出于 2021-04-15 09:17