0

I have a react project and initialized hardhat config then installed the necessary packages but I am getting error when I require hardhat on my project const hre = require("hardhat");

This is error message when the project is compiling

./node_modules/@sentry/node/esm/integrations/console.js
Module not found: Can't resolve 'console' in 'C:\Users\sss\OneDrive\Desktop\my-react\node_modules\@sentry\node\esm\integrations'

How do I resolve this issue?

1
  • 1
    Are you requiring hardhat from your React code? Because that won't work, hardhat is meant to be executed with node. Jan 29 at 19:46
0

I was getting the same error and what fixed it for me was changing my imports statement for ethers from import { ethers } from 'hardhat'; to import { ethers } from 'ethers';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.