反应本机初始化不起作用 [英] React native init not working

查看:41
本文介绍了反应本机初始化不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 react native github 中发布了这个,但被要求在这里发布

I posted this in the react native github but was asked to post here

我按照网站上的说明启动并运行 React Native 应用程序.

I following the instructions on the website to get a react native app up and running.

我收到以下消息Genymotion Andriod 模拟器参考错误:找不到变量_fbBatchedBridgeIOS模拟器无法执行JS调用:_fbBatchedBridge未定义React Package Manager 同步失败

I get the following messages Genymotion Andriod simulator Reference Error: can't find variable _fbBatchedBridge IOS simulator Unable to execute JS call: _fbBatchedBridge is undefined React Package Manager synchonization failed

React 原生版本 0.18.0反应本机 cli 0.1.10节点 4.2.4

React native version 0.18.0 React native cli 0.1.10 Node 4.2.4

Mac 操作系统 X 优胜美地XCode 7.2 版

Mac Os X Yosemite XCode Version 7.2

在研究这一点时,许多人声称问题出在网络上.我打开了一个指向 localhost:8081 的浏览器,并获得了一个无法 GET/

In researching this many claim that the issue is with the network. I opened a browser pointing at localhost:8081 and get a webpage with Cannot GET /

目前我在 IOS 模拟器上没有收到任何错误消息,只是一个空白的白屏.Android 在 Genymotion 和我的本地 android 设备上仍然给出相同的错误消息.

Currently I am not getting any error message on the IOS simulator, just a blank white screen. Android is still giving the same error message on both Genymotion and on my local android device.

终端或 XCode 中没有错误消息.

There are no error messages on the Terminal or in XCode.

尝试排除故障非常令人沮丧,因为我不知道为什么它不起作用,甚至不知道从哪里开始.

This is very frustrating to try to troubleshoot since I have no idea why it is not working and even where to start.

推荐答案

这个错误是因为脚本服务器没有运行.

This error is because the script server is not running.

Android 版本,除了执行 'react-native run-android' 构建应用程序,还需要执行 'react-native start' 来启动脚本服务器.

For Android version, in addition to execute 'react-native run-android' to build the app, you need to execute 'react-native start' to start the script server.

在 XCode 中,当您运行应用程序时,终端应自动启动,但您的情况似乎有问题.您是否尝试关闭终端窗口并重新开始?

In XCode when you run the application the terminal should be started automatically, but it seems something is wrong in your case. Did you try to close the terminal window and start over?

==============================首次启动脚本服务器时,控制台应显示

============================== when you first start the script server, the console should show

[18:07:15] <START> Building Dependency Graph
[18:07:15] <START> Crawling File System
[18:07:15] <START> Loading bundles layout
[18:07:15] <END>   Loading bundles layout (1ms)

React packager ready.

当您的客户端连接到服务器时,控制台应显示

When your client connects to the server, the console should show

[18:07:25] <START> request:/index.android.bundle?platform=android&dev=true
[18:07:25] <START> find dependencies
[18:08:01] <END>   Crawling File System (45771ms)
[18:08:01] <START> Building in-memory fs for JavaScript
[18:08:04] <END>   Building in-memory fs for JavaScript (3382ms)
[18:08:04] <START> Building in-memory fs for Assets
...

如果第二部分没有出现,您可能需要检查是否可以使用该端口:使用此图像,您可以看到 url 应该是 http://localhost:8081/index.android.bundle?platform=android&dev=true .如果您无法在浏览器中打开它,您可能需要检查您的防火墙设置或其他任何阻止访问的内容.

if the second part was not showing up, you may want to check whether you can use the port: With this image you can see the url should be http://localhost:8081/index.android.bundle?platform=android&dev=true . If you cannot open it in your browser you may need to check your firewall setting or anything else blocking the access.

此外,您可能还想在本机代码中搜索 index.android.bundle 以检查 dev url 是否已被修改.

Also you may want to search index.android.bundle in your native code to check whether the dev url has been modified.

这篇关于反应本机初始化不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆