I have successfully installed openzeppelin/contracts, but I am unable to import it. It shows me an error which is
Source "@openzeppelin/contracts/access/Ownable.sol" not found: File import callback not supported
Does anyone have any idea?
I have successfully installed openzeppelin/contracts, but I am unable to import it. It shows me an error which is
Source "@openzeppelin/contracts/access/Ownable.sol" not found: File import callback not supported
Does anyone have any idea?
Please Check the @openzeppelin/contracts is installed in Correct Directory..
Also What npm version of @openzeppelin/contracts you have installed ? The positon of OpenZepplin Contracts is changed after version 4..
Refer..
https://forum.openzeppelin.com/t/openzeppelin-contracts-ownership-ownable-sol-not-found/16229/3
https://forum.openzeppelin.com/t/error-importing-openzeppelin-contracts-in-vscode/6971/11
Simplest hack:
CTRL + SHIFT + P -> Reload Window
Your question is not very clear but I will try and provide an answer in the context in which I understood it as I also face similar issue.
"@openzeppelin/contracts/access/Ownable.sol"
The import form above works well for solidity version 0.6.x but if you are using solidity version ^0.8.x it doesn't work.
This is how I resolved the issue. First install openzeppelin with the npm installer:
npm i @openzeppelin/contracts
The command above will install the current version of openzeppelin. At the time of writing this, the current version is 4.x. After the install is successful import openzeppelin this way:
import "../node_modules/@openzeppelin/contracts/access/Ownable.sol";
That is the directory where npm installed it.
I hope this helps someone.