0

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. 
1
  • what's the version in your hardhat.config? Commented Jan 10, 2024 at 8:50

1 Answer 1

0

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.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.