[英]Tried to compile contract using hardhat but got error:- Error: The specified module could not be found
[英]HardHat: Nothing to compile
编译 hardhat 项目时显示Nothing to Compile 。
{
"name": "HardhAtToken",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.6",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"chai": "^4.3.6",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.6.6",
"hardhat": "^2.9.6-dev.1"
},
"dependencies": {
"glob": "^7.2.0"
}
}
Hardhat 在cache
项目文件夹中保留已编译合约的缓存。
npx hardhat compile
命令仅编译自上次编译以来未更改的文件。 因此,在您的情况下,预计会出现“无需编译”消息。
您可以使用npx hardhat clean
清除缓存,或者使用npx hardhat compile --force
参数强制重新编译缓存的源。
文档: https ://hardhat.org/guides/compile-contracts.html
主要问题是您没有在代码中创建合同目录。然后您可以在其中实现 sol 文件并运行 npx hardhat compile..它对我有用...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.