首页 > 解决方案 > 错误 HH12:尝试使用不支持的非本地安装的 Hardhat。请使用 npm 或 Yarn 在本地安装 Hardhat,然后重试

问题描述

我从事安全帽项目已经有一段时间了。
过了一会儿,当我运行 npx hardhat node 启动 HH 服务器时,我收到以下错误:

这是错误的图像

我尝试研究错误并在安全帽网站上找到了这个

   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.

有趣的是,我创建了一个新的 HH 项目并重新安装了所有内容,
然后将我的代码导入到新项目中,这似乎解决了问题……
但过了一段时间,问题又开始了。
每次发生这种情况时,我都无法继续创建新项目。
我已经被困了好几天了,将不胜感激。

操作系统:windows10

标签: ethereumchainlinkhardhat

解决方案


尽量不要使用 npx hardhat ...运行安全帽,使用 npm hardhat ...或 yarn hardhat ...在本地运行它,其他可能在 Windows 上导致此错误的东西是 git bash,如果你使用的是 git bash 你在这种情况下将无法运行安全帽尝试在 cmd 中使用 npm 或 yarn 在本地运行它


推荐阅读