'Source "@openzeppelin/contracts/token/ERC721/ERC721.sol" not found: File import callback not supported

I've imported the Open Zeppelin ERC721 token standard into my VS Code with the Solidity extension, but see the following warnings on all my OZ import statements:

Screenshot of error

Why is this happening and what is the workaround for this warning?

What I've tried:

  • change default workspace compiler to localNodeModule (began to throw other warnings like on the pragma solidity line)

Example of solution I've tried



Solution 1:[1]

Just install the Solidity+Hardhat Extension ,this will take care of the errror.

Solution 2:[2]

Ok. That was a dumb question. Two things you have to do:

(1) Install the OZ library via npm install @openzeppelin/contracts

(2) If you see Error HH606 (i.e. project can't compile), it's likely because The Solidity version pragma statement in these files doesn't match any of the configured compilers in your config.. Ensure that your pragma version matches the version in your hardhat config.

Hope this helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mayur Bhamare
Solution 2 jimmythecoder