I've been working on a Hardhat project for sometime.
After a while, when I run
npx hardhat node
to start the HH server, I get the error below:
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 can't keep creating a new project each time this happens.
I've been stuck for days now and will appreciate any help.
OS: windows10
Do not install Hardhat globally. If you already have installed hardhat globally, please uninstall as the issue might be because of that as mentioned in the error message.
Things you need to do to mitigate this:
npm install --save-dev hardhat
or yarn add --dev hardhat
npm install
or yarn install
to install all dependencies.npx hardhat compile
or npx hardhat node
to check if it works.