简体   繁体   English

找不到模块:无法解析“hardhat”

[英]Module not found: Can't resolve 'hardhat'

How to get rid of this error?如何摆脱这个错误?

Failed to compile.编译失败。

./src/components/NFTViewer.jsx
Module not found: Can't resolve 'hardhat' in 'C:\Users\nick_\VSCodeProjects\nft\nft-school-examples\end-to-end\packages\react-app\src\components'

Here my project structure这是我的项目结构

在此处输入图像描述

I have added this line on top of my file我在文件顶部添加了这一行

import { ethers } from "hardhat";

the problem is hardhat does not exist in react-app 's package.json.问题是安全帽在react-app的 package.json 中不存在。 You will need to navigate to the root of react-app and run npm install --save-dev hardhat .您需要导航到 react-app 的根目录并运行npm install --save-dev hardhat

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM