小编Key*_*ode的帖子

错误:安装 web3 并实现到 React Native App.js 后,Webpack < 5

在尝试在我的 React Native 网站中安装和使用 web3 后出现错误,我正在构建该网站以了解有关 web3 开发的更多信息。安装web3后然后添加:

import Web3 from 'web3';

const web3 = new Web3(Web3.givenProvider || "http://localhost:8545");
web3.eth.getAccounts().then(console.log);
Run Code Online (Sandbox Code Playgroud)

在我的 App.js 文件中,我收到了以下错误:

Compiled with problems:X

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

Module not found: Error: Can't resolve 'stream' in '/Users/keyesbruh/Documents/Programming/nft-project/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.

If you want to include a polyfill, you …
Run Code Online (Sandbox Code Playgroud)

reactjs webpack react-native web3js

3
推荐指数
1
解决办法
1759
查看次数

标签 统计

react-native ×1

reactjs ×1

web3js ×1

webpack ×1