I tried researching the error and found this on the hardhat site
HH12: Hardhat is not installed or installed globally
You tried to run Hardhat from a global installation or not installing it at all. This is not supported.
Please install Hardhat locally using npm or Yarn, and try again.
Funny enough, i created a new HH project and installed everything afresh then imported my code into the new project and this seemed to solve the problem... but after sometime, the issue began again. I cant keep creating a new project each time this happens.
I've been stuck for days now and will appreciate any help, Thanks.
Sure, @Skyge , i already did that.
There wasnt any reply.
Some concerned devs on stackoverflow suggested i install hardhat globally, ill be doing that next.
Thanks for your help... sorry i'm seeing this kinda late.
Do not install Hardhat globally. If you already have installed hardhat globally, please uninstall as the issue might be because of that itself as mentioned in the error message.
Things you need to do to mitigate this:
Check if the project package.json has hardhat as its dev dependency. If it is not, run npm install --save-dev hardhat or yarn add --dev hardhat
Uninstall any global version of hardhat
Remove node_modules and run npm install or yarn install to install all dependencies.
Hi guys,
In my case, I did exatcly as @sudeepb02 mentioned. It worked like a charm for ONE run, got the output in the command line. Then I got the exact same issue as @Kelvin_Okorie . Please share your package.json. You most likely have unmet dependencies. I would remove node_modules/ or unistall them all, then install your main dependencies with
npm install
and only after install your development dependencies with
npm install -D
after this try npx hardhat compile. then run npx hardhat test
I'm guessing this issue is caused by secondary dependencies being loaded first.