Getting error while import

Hey guys, I imported this:- import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; but getting an error :- Source "@openzeppelin/contracts/security/ReentrancyGuard.sol" not found: File outside of allowed directories.solidity(6275).. Any help!

So have you installed the dependency?

you can run npm install @openzeppelin/contracts and then have a try.

Yes, I have already installed it.

Make sure the version of @openzepplin/contracts is Current version - "4.x". https://docs.openzeppelin.com/contracts/4.x/api/security#ReentrancyGuard

The file was relocated to another path, now you need to import it with the following command:
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
The new folder is utils instead of security.

1 Like