When compiling the hardhat project When it's showing 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 keeps a cache of compiled contracts in the cache
project folder.
The npx hardhat compile
command only compiles files that have not been changed since the last compilation. So the "nothing to compile" message is expected in your case.
You can either clear the cache using npx hardhat clean
, or force recompilation of cached sources using the npx hardhat compile --force
argument.
The major issue with that you haven't created a contracts directory in your code.Then you can implement sol file in it and run npx hardhat compile..It was worked for me...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.