ParserError: Source not found: File import callback not supported

Hey folks,

maybe a noobs problem, but… I’ve installed solidity compiler v0.8.6 (on windows 10 pc) and want to compile a smart contract using import command.

I get the following error:

ParserError: Source “@openzeppelin/contracts/token/ERC721/ERC721.sol” not found: File import callback not supported
→ main-nft.sol:3:1:
|
3 | import ‘@openzeppelin/contracts/token/ERC721/ERC721.sol’;

This is the source-code:

pragma solidity ^0.8.6;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
contract SimpleCollectible is ERC721 {
  uint256 public tokenCounter;
  constructor () public ERC721 ("Dogie", "DOG"){
    tokenCounter = 0;
  }

  function createCollectible(string memory tokenURI) public returns (uint256) {
    uint256 newItemId = tokenCounter;
    _safeMint(msg.sender, newItemId);
    _setTokenURI(newItemId, tokenURI);
    tokenCounter = tokenCounter + 1;
    return newItemId;
  }
}

I tried import on different ways: “./openzeppelin…”, Full path, importing from github directly (import https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol but I get always this error.

I’ve installed the compiler global.

Thanks for any help in advance,

Res

This forum is not a good place for asking support questions. Read this before posting!

I think that your problem might be simply that you did not install the @openzeppelin/contracts package. If you have trouble getting it to work, please drop by at the #solidity channel on Gitter.