【发布时间】:2022-01-25 02:08:49
【问题描述】:
我在编译时遇到了 React 应用程序的问题。 请在下面找到问题并截图。
ERROR in ./node_modules/web3-providers-http/lib/index.js 30:11-26
Module not found: Error: Can't resolve 'http' in '/Users/rohit/Downloads/Personal/web3/react-minting-website/node_modules/web3-providers-http/lib'
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.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
@ ./node_modules/web3-core-requestmanager/lib/index.js 56:16-46
@ ./node_modules/web3-core/lib/index.js 23:23-58
@ ./node_modules/web3/lib/index.js 32:11-31
@ ./src/index.js 10:0-24 14:13-17
经过审查,我发现问题与 web3 相关的依赖项有关:
https://www.npmjs.com/package/web3
https://www.npmjs.com/package/@web3-react/core
https://www.npmjs.com/package/@web3-react/injected-connector
有人可以帮助我吗?我正在使用 LTS 版本,这些是什么稳定版本?
请提出建议。
【问题讨论】:
标签: javascript reactjs create-react-app web3 web3js