OpenZeppelin contracts unable to import to HardHat using npm install @openzeppelin/contracts

I keep getting npm errors:

Hey @GratefulZebra9, welcome!

Is this happening while doing npm @openzeppelin/contracts?

Can you provide more context about the action you're doing and your package.json? Seems like this is a conflict between two libraries that are using different versions of hardhat dependencies. Should be solvable by identifying the conflicting packages and setting them to compatible versions.

Best

Hi Ernestognw,

Thank you for the reply and you are right!!

I had both hardhat-deploy-ethers and @nomicfoundation/hardhat-toolbox, which isn't compatible, so I removed one of them.

But I encounter another problem when I use the npx hardhat run script/deploy.js --network goerli.

Terminal Error: Error HH100: Network goerli doesn't exist
I'm also trying to find Hardhat Network Config file where Goerli resides.

1 Like

Hey @GratefulZebra9, I'm glad it worked.

The problem I see now with your configuration is that you should either:

  • Run npx hardhat run script/deploy.js --network goerli or
  • Rename Goerli to goerli in your config file

The scripts take the --network <NETWORK_NAME> flag, where NETWORK_NAME is exactly the network key you define in your configuration.

@ernestognw, I rename it goerli and tried it again npx hardhat run script/deploy.js --network goerli

But received the same error is there something else I'm missing ?