current position:Home>Hardhat solidity has different versions and cannot be compiled normally

Hardhat solidity has different versions and cannot be compiled normally

2022-02-04 00:12:49 Q & A of Denglian community

hardhat.config.js

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

Compile time exception prompt

npx hardhat compileSolidity 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






Other answers 1:


Other answers 2:

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202040012470809.html

Random recommended