Version
"web3": "^1.2.1"
"react-native": "0.59.10"
From set-up tutorial and https://github.com/ethereum/web3.js/issues/1022 , I was able to install web3
in react-native
, however I got this error:
Error
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)The error occurs when I doing promise method like
web3.eth.getTransactionCountor
web3.eth.getBlock('latest'). I tried
console.log(web3.version)` , no problem at all
1条答案
按热度按时间zyfwsgd61#
我发现使用
web3@1.0.0-beta.34
对于react-native
来说更稳定,所以提到的问题不再出现。