Cannot find module '@nomicfoundation/hardhat-toolbox'

17.7k Views Asked by At

enter image description here

I meet this issue when try to run the js file

8

There are 8 best solutions below

1
Styx On

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:

  1. 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.
  2. 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 command npm i @nomicfoundation/hardhat-toolbox.

This should work, if it doesn't then please provide more information.

1
Guman Singh On

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.

0
Christopherus On

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

0
Siddharth Singh Baghel On

I simply installed the package using npm install --save-dev @nomicfoundation/hardhat-toolbox and then tried compiling and it worked for me.

0
code-assassin On

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
0
Mujahid Shaik On

npm install --save-dev @nomicfoundation/hardhat-toolbox --force

INSTALL FORCEFULLY

1
rajat kumar singh On

For me, I simply write this command:

npm install -i --save-dev @nomicfoundation/hardhat-toolbox --force
0
Oguzhan Uzunay On

I think is not working without --force. Problem simple solve when I use this code below:

npm install -i --save-dev @nomicfoundation/hardhat-toolbox --force