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

Viewed 2698

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

3 Answers

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

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.

run below command

npm install @openzeppelin/contracts

Change the import line like this

 import "./node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol";        
Related