# Error HH12: Trying to use a non-local installation of Hardhat, which is not supported. Please install Hardhat locally using npm or Yarn, and try again

**URL:** <https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880>\
**Category:** Meta\
**Tags:** hardhat\
**Created:** [November 14, 2021, 3:05am UTC](https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880 "2021-11-14T03:05:20Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kelvin\_Okorie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/kelvin_okorie/32/12570_2.png) [@Kelvin\_Okorie](https://forum.openzeppelin.com/u/Kelvin_Okorie)\
**Post date:** [November 14, 2021, 3:05am UTC](https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880/1 "2021-11-14T03:05:20Z")

</div>

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.  
  
[This is an image of the error](https://i.stack.imgur.com/ASX3F.jpg)

I tried researching the error and found this on the [hardhat site](https://hardhat.org/errors/#HH12)

```
   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.

#### 💻 Environment

I'm using: Hardhat, Windows OS

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [November 14, 2021, 4:05am UTC](https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880/2 "2021-11-14T04:05:55Z")

</div>

Hi, welcome! 👋

It seems like a problem about the tool: `Hardhat`, so why not try to ask the hardhat team? I know they have a discord: [https://discord.gg/ArkuKrdbdm](https://discord.gg/ArkuKrdbdm)

So how about installing `hardhat` in the global environment by `npm install --global hardhat`, and maybe you can reopen a new terminal to have a try.

---

<div class="post-metadata">

**Author:** ![Kelvin\_Okorie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/kelvin_okorie/32/12570_2.png) [@Kelvin\_Okorie](https://forum.openzeppelin.com/u/Kelvin_Okorie)\
**Post date:** [November 15, 2021, 10:42am UTC](https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880/3 "2021-11-15T10:42:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sudeepb02](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/sudeepb02/32/3119_2.png) [@sudeepb02](https://forum.openzeppelin.com/u/sudeepb02)\
**Post date:** [November 15, 2021, 11:17am UTC](https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880/4 "2021-11-15T11:17:55Z")

</div>

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:

1. 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`
2. Uninstall any global version of hardhat
3. Remove node\_modules and run `npm install` or `yarn install` to install all dependencies.
4. Try running npx hardhat compile/node

This should fix your issue.

---

<div class="post-metadata">

**Author:** ![Kelvin\_Okorie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/kelvin_okorie/32/12570_2.png) [@Kelvin\_Okorie](https://forum.openzeppelin.com/u/Kelvin_Okorie)\
**Post date:** [November 15, 2021, 11:52am UTC](https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880/5 "2021-11-15T11:52:28Z")

</div>

Thanks @sudeepb02

- I've not tried installing hardhat globally...yet 🙂
- Also hardhat is part of my projects main dependencies... not the devDependencies, don't know if this could be part of the problem.

I'll follow your steps right way, hope it works.  
Thanks again.

---

<div class="post-metadata">

**Author:** ![Skyge](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/skyge/32/343_2.png) [@Skyge](https://forum.openzeppelin.com/u/Skyge)\
**Post date:** [November 16, 2021, 1:24am UTC](https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880/6 "2021-11-16T01:24:27Z")

</div>

Ohhhh, thanks for correcting my point.

---

<div class="post-metadata">

**Author:** ![QuicktriXXX](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/quicktrixxx/32/15063_2.png) [@QuicktriXXX](https://forum.openzeppelin.com/u/QuicktriXXX)\
**Post date:** [May 25, 2022, 12:26pm UTC](https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880/7 "2022-05-25T12:26:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dipak\_B](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/dipak_b/32/17010_2.png) [@Dipak\_B](https://forum.openzeppelin.com/u/Dipak_B)\
**Post date:** [November 22, 2022, 10:05am UTC](https://forum.openzeppelin.com/t/error-hh12-trying-to-use-a-non-local-installation-of-hardhat-which-is-not-supported-please-install-hardhat-locally-using-npm-or-yarn-and-try-again/18880/8 "2022-11-22T10:05:24Z")

</div>

actually its really helpful... thanks sir
