index.io.bundle 在使用 iOS 模拟器到 运行 第一个 React Native 应用程序时未找到

index.io.bundle not found while using iOS simulator to run first React Native app

遵循 React NativeGetting Started 文档, 一个包含红色背景的 HTML 页面 <p>The requested URL /index.ios.bundle was not found on this server.</p> 当点击 cmd+R 到 运行 我的第一个应用程序时呈现。

当预期结果应该是从 index.ios.js 呈现的主页时,为什么会发生这种情况?

我有另一个程序监听端口 8081,它从本地主机用于服务包(/index.ios.bundle),因此我不得不停止这个程序监听端口 8081 以便让 React Packager 正常工作。

我可以使用以下命令确定正在侦听的程序:

lsof -n -i4TCP:8081 | grep LISTEN