6

I'm using hardhat to write a dapp. As I'm compiling my dapp I'm getting an error:

Error HH700: Artifact for contract "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:OwnableUpgradeable" not found.

My dapp has some dependencies to openzeppelin contracts but not to this specific one. I added the required import and then got the same error, this time with @openzeppelin/contracts/access/Ownable.sol.

Added the required import and got the same with @openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol/

After adding those 3 imports the dapp finally compiled.

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

This dapp went through some phases and had in the past dependencies to those imported contracts but now it doesn't. The problem started when I deleted the artifacts folder and tried to compile. The compiler is right - those contracts can't be found in the artifacts folder but also my dapp doesn't really use them, so what would the compiler ask for them?

I'm using solidity 0.8.6.

1

1 Answer 1

7

gm. Have you tried with npx hardhat clean before compiling? It will clear the cache and delete all artifacts.

Source

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.