Skip to main content
2 of 2
added 41 characters in body
aoki
  • 1
  • 1

Error HH19: Your project is an ESM project (I already tried to changed chai from ^5.0.0 to ^4.3.7 but still failed)

When I tried to npx hardhat compile, error HH19 showed up I already changed the chai from ^5.0.0 to ^4.3.7 and changed the file name from js to cjs, and the error still shows up. Any ideas on how to fix it?

Before this, this error also showed up. Error: Cannot find module '@nomicfoundation/hardhat-toolbox so I tried with npm install --save-dev @nomicfoundation/hardhat-toolbox --force

package.json

{
  "name": "modify-contract-state",
  "version": "1.0.0",
  "description": ",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@nomicfoundation/hardhat-toolbox": "^4.0.0",
    "hardhat": "^2.19.4"
  },
  "dependencies": {
    "@nomiclabs/hardhat-ethers": "^2.2.3",
    "@nomiclabs/hardhat-waffle": "^2.0.6",
    "chai": "^4.3.7",
    "ethereum-waffle": "^4.0.10",
    "ethers": "^5.7.2"
  }
}

Hardhart config.js

require("@nomicfoundation/hardhat-toolbox");

require("@nomiclabs/hardhat-ethers");

module.exports = {
  solidity: "0.8.4",
};

My reference is from Alchemy University I'm new to blockchain dev and looking forward with you guys

aoki
  • 1
  • 1