in trying to compile a contract i keep getting this error: The Solidity version pragma statement in these files doesn't match any of the configured compilers in your config. Change the pragma or configure additional compiler versions in your hardhat config.

  • @openzeppelin/contracts/token/ERC721/ERC721.sol (^0.8.20)
  • @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol (^0.8.20)
  • @openzeppelin/contracts/token/ERC721/IERC721.sol (^0.8.20)
  • @openzeppelin/contracts/utils/introspection/IERC165.sol (^0.8.20)
  • @openzeppelin/contracts/utils/introspection/ERC165.sol (^0.8.20)
  • @openzeppelin/contracts/interfaces/draft-IERC6093.sol (^0.8.20)
  • @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol (^0.8.20)
  • @openzeppelin/contracts/utils/Strings.sol (^0.8.20)
  • @openzeppelin/contracts/utils/math/SignedMath.sol (^0.8.20)
  • @openzeppelin/contracts/utils/math/Math.sol (^0.8.20)
  • @openzeppelin/contracts/utils/Context.sol (^0.8.20)

These files and its dependencies cannot be compiled with your config. This can happen because they have incompatible Solidity pragmas, or don't match any of your configured Solidity compilers.

pragma solidity ^0.8.18;

// Import the openzeppelin contracts 
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

// NFTee is ERC721 signifies that the contract we are creating imports ERC721 and follows ERC721 contract from openzeppelin

contract NFTee is ERC721 {
    constructor() ERC721("NFTee", "ITM") {
        // mint the NFT to yourself
        _mint(msg.sender, 1);

i have already tried modifying my pragma statement to "^0.8.20" but this causes other issues to arise in my code. any help is highly appreciated.
  • what's the version in your hardhat.config? Commented Jan 10 at 8:50

1 Answer 1


Put this in you hardhat.config,js file:

module.exports = {
  solidity: {
    version: "0.8.20",

This will tell hardhat what version to use for compiling.

  • thank you so much!
    – kattyd
    Commented Jan 10 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.