hardhat npx hardhat test Error HHE902: There was an error while resolving the import "forge-std/Script.sol" from "./contracts/script/Counter.s.sol": The package "forge-std" is not installed.
When running the following command
npx hardhat test
Error HHE902: There was an error while resolving the import "forge-std/Script.sol" from "./contracts/script/Counter.s.sol":
The package "forge-std" is not installed.
This is due to the standard nodejs library that is not installed. Please ensure that your package.json has the following settings.
{
"name": "hardhat2-example",
"version": "1.0.0",
"type": "module",
"devDependencies": {
"@nomicfoundation/hardhat-ignition": "^3.0.7",
"@nomicfoundation/hardhat-toolbox-viem": "^5.0.2",
"@types/node": "^22.19.9",
"forge-std": "github:foundry-rs/forge-std#v1.9.4",
"hardhat": "^3.1.7",
"typescript": "~5.8.3",
"viem": "^2.45.1"
}
}
Comments