我在这里面临着巨大的复杂性,我的应用程序无法启动,我遇到了以前从未遇到过的奇怪错误。我通过Expo运行我的应用程序,只是作为一个旁注。
[未处理的承诺拒绝:类型错误:网络请求失败]
- node_modules\whatwg fetch\dist\fetch.umd.js:535:17 in setTimeout$argument_0
- _callTimer中的node_modules\react native\Libraries\Core\Timers\JSTimers.js:130:14
- callTimers中的node_modules\react native\Libraries\Core\Timers\JSTimers.js:383:16
- node_modules\react native\Libraries\BatchedBridge\MessageQueue.js:416:4在__callFunction中
- node_modules\react native\Libraries\BatchedBridge\MessageQueue.js:109:6在__guard$argument_0中
- node_modules\react native\Libraries\BatchedBridge\MessageQueue.js:364:10在__guard
- node_modules\react native\Libraries\BatchedBridge\MessageQueue.js:108:4在callFunctionReturnFlushedQueue中
- [本机代码]:callFunctionReturnFlushedQueue中为null
我已经试过重新安装expo了,但对我没有任何帮助。
3周前,当我从编码开始休息时,一切都很好。我不知道问题出在哪里,错误不是指向代码的任何特殊部分。我可以为你提供任何需要的信息,因为在这一点上,我甚至不知道从哪里开始寻找任何错误。
如果您使用的是模拟器,那么问题可能是Android/ios上的localhost指向模拟的Android/ios设备,而不是运行服务器的机器。
解决方案是将localhost替换为您机器的IP地址。尝试用http://10.0.2.2:4000/
更改http://localhost:4000
我从这篇文章中得到了这个也许这对有帮助
这是因为您的whatwg获取停止了与该url的连接,因为一次有多个调用所以只需更改路线名称例如:如果您的Url类似于";http://10.0.2.2:4000/login"把它改成一个新名字,比如";http://10.0.2.2:4000/loginuser"并尝试