hardhat-starter-kit icon indicating copy to clipboard operation
hardhat-starter-kit copied to clipboard

Unexpected Error-npx hardhat compile in hardhat-starter-kit

Open ajeetk1 opened this issue 3 years ago • 2 comments

Hi All,

I just found an error when execute npx hardhat compile in hardhat-starter-kit :

"npx hardhat An unexpected error occurred: Error: Cannot find module '@nomiclabs/hardhat-waffle' Require stack:"

I have also added "ry "npm install -D @nomiclabs/hardhat-waffle ethereum-waffle" &

Still same unexpected error.

Thanks

ajeetk1 avatar Jun 22 '22 08:06 ajeetk1

Hi @ajeetk1, can you try to install the packages first after cloning the repo (using yarn or npm i) and then compile contracts using yarn compile or npm compile? Let's try to exclude npx and see if the issue will go away. Thanks

andrejrakic avatar Jun 22 '22 09:06 andrejrakic

This answer is from Patrck Collins's solidity course.

We need to delete the unwanted config file.

  1. Find it
  npx hardhat --verbose
  hardhat:core:config Loading Hardhat config from /Users/hardhat.config.js
  1. Then Remove it
rm /Users/hardhat.config.js

Try yarn hardhat again, this works for me.

yangyueche avatar Sep 19 '22 06:09 yangyueche