Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HardHat: Nothing to compile

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"
  }
}
like image 459
Ng Sharma Avatar asked May 07 '26 06:05

Ng Sharma


1 Answers

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.

Docs: https://hardhat.org/guides/compile-contracts.html

like image 109
Petr Hejda Avatar answered May 09 '26 20:05

Petr Hejda