1

I am trying to build a simple react app calling a smart contract, however while running - I get multiple issues with webpack, node modules. Most of the issues are pointing to resolve error This react app was created with the create-react-app module. Here are the errors

ERROR in ../node_modules/cipher-base/index.js 3:16-43

Module not found: Error: Can't resolve 'stream' in 'C:\Sandip@IBM\BlockChainDev\MultiSigWallet\node_modules\cipher-base'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

Similarly the other errors

ERROR in ../node_modules/eth-lib/lib/bytes.js 7:193-227

Module not found: Error: Can't resolve 'crypto' in 
ERROR in ../node_modules/swarm-js/node_modules/eth-lib/lib/bytes.js 9:193-227
ERROR in ../node_modules/web3-eth-accounts/lib/index.js 33:74-91

ERROR in ../node_modules/web3-providers-http/lib/index.js 30:11-26

Module not found: Error: Can't resolve 'http' in 

I am bit lost on how to resolve these dependecy errors.

Thanks

BlockChain Learner
  • 125
  • 1
  • 10
  • 18
  • 1
    check the answer here https://stackoverflow.com/questions/70472965/web3-issue-react-application-not-compiling/70512623#70512623 – Yilmaz Feb 08 '22 at 19:06

1 Answers1

2

If my guess is correct, you are using react-script 5.0 + please use "react-scripts": "4.0.3", that issue is because of webpack config. there are several way to fix that problem but I think this way is simple solution.

Keigo Igarashi
  • 113
  • 1
  • 1
  • 13