I meet this issue when try to run the js file
-
You're not giving enough information. What code are you trying to run? What are you trying to do? – Lucas Raza Aug 21 '22 at 03:10
6 Answers
Simply install the package by entering yarn add --save-dev @nomicfoundation/hardhat-toolbox
or npm install --save-dev @nomicfoundation/hardhat-toolbox
.
But if you are getting the same error again and again and the package is present in package.json then you might be using npm and yarn parallely, just uninstall either of it and you are good to go.

- 2,386
- 26
- 22

- 171
- 2
-
why is this step needed? why didn't 'yarn add hardhat' add all basic things? thank you – oldpride Mar 22 '23 at 00:48
Please provide your 'hardhat.config.js' and 'package.json' file screenshots. To provide the answer, such information is necessary.
In my opinion, you may not have installed all the required packages. Please check if you have the following things in your files:
require("@nomicfoundation/hardhat-toolbox");
make sure you have this in your hardhat.config.js file. If not, replace the first line of the file with the above code.- Also, check if you have
@nomicfoundation/hardhat-toolbox
this dependency in your package.json file, If not, you may install it using any package manager (npm or yarn) with the commandnpm i @nomicfoundation/hardhat-toolbox
.
This should work, if it doesn't then please provide more information.

- 31
- 1
Remove the ethers dependency with yarn remove ethers
than you can install and add hardhat again, that worked for me
You have to do this because hardhat has it's own ethers module, otherwise the two would get in each other's way

- 75
- 7
npm install --save-dev @nomicfoundation/hardhat-toolbox --force
INSTALL FORCEFULLY

- 11
- 1
I simply installed the package using npm install --save-dev @nomicfoundation/hardhat-toolbox
and then tried compiling and it worked for me.
For me reinstalling the nomicfoundation/hardhat-toolbox didnt work. I got error
Error HH801: Plugin @nomicfoundation/hardhat-toolbox requires the following dependencies to be installed:
To fix it and deploy my project I had to install all the dependencies using the command
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers

- 415
- 4
- 14