react-native - 尝试构建 android 应用程序时出现构建 iOS 捆绑包错误 - expo -react-native
问题描述
我能够使用expo build:android
以前构建应用程序。但是,升级到最新的世博会版本后,我收到以下错误:
connect ECONNREFUSED 127.0.0.1:19001
Set EXPO_DEBUG=true in your env to view the stack trace.
我还在日志中看到以下几行:
Publishing to channel 'default'...
Building iOS bundle
我没有将ios添加到我的app.json中,我只需要构建一个android apk。为此,我使用expo build:android -t app-bundle
我还删除package-lock.json
并node_modules
运行了 npm install,但我得到了同样的错误。
我expo start
在另一个 cmd 上运行,然后运行expo build:android -t app-bundle
仍然得到同样的错误
此外,当我清除 expo 缓存时,请参阅以下日志:
Restarting Metro Bundler...
Starting Metro Bundler on port 19001.
Couldn't adb reverse: adb.exe: error: Invalid source port: 'undefined'
解决方案
我自己也遇到过同样的问题并找到了解决方案。Expo 正在寻找未运行的localhost:19001 。只需按照以下步骤操作,它应该可以按预期工作:
- 不运行
expo start
任何终端,一旦它打开浏览器,您将在其中找到此行,即在端口 19001 上启动 Metro Bundler。 - 现在打开另一个终端实例并运行
expo build:android
.
推荐阅读
- python - 如何使用 PyVista 从列表/数组创建自定义 3D 对象?
- python - 将一个类的多个函数绑定到另一个类的类事件:有更好/更短的方法吗?
- javascript - 使用 axios.get() 制作提交列表时遇到问题
- git - 无法 git push 致命:远程错误:服务未启用
- ios - 尝试插入按钮时出现问题?(斯威夫特用户界面)
- xcode - SwiftUI动态修改TextField格式、字符串模式、掩码
- python - 从 cmd 运行 powershell 命令
- c# - 如何将 ModelExpression 绑定到 ASP.NET Core 中的 ViewComponent?
- angular - Angular中的styleSheet中的Cytoscape js错误
- python - 轴参数在keras的点层中有什么作用?