【发布时间】:2019-08-26 10:23:00
【问题描述】:
版本
"web3": "^1.2.1"
"react-native": "0.59.10"
从set-up tutorial 和https://github.com/ethereum/web3.js/issues/1022,我能够在react-native 中安装web3,但是我收到了这个错误:
错误
Possible Unhandled Promise Rejection (id: 1):
TypeError: Cannot read property 'getReader' of undefined
TypeError: Cannot read property 'getReader' of undefined
at new exports.IncomingMessage (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:222317:34)
at module.exports.ClientRequest._connect (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:222201:22)
at blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:222115:14
at tryCallOne (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:45372:14)
at blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:45473:17
at blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:46351:21
at _callTimer (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:46240:9)
at _callImmediatesPass (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:46276:9)
at Object.callImmediates (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:46495:14)
at MessageQueue.__callImmediates (blob:http://localhost:8081/4f48abd1-1bd3-445a-bdbc-3cdeca3a37a2:16572:16)
当我执行诸如web3.eth.getTransactionCount 或web3.eth.getBlock('latest') 之类的promise 方法时发生错误。
试试
我试过console.log(web3.version),完全没问题
【问题讨论】:
-
给我看你正在尝试的代码,而不是你研究的链接。
标签: react-native promise ethereum web3