React无法在任何根中找到条目文件 [英] React cannot find entry file in any of the roots

查看:235
本文介绍了React无法在任何根中找到条目文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS项目中使用React Native作为Pod。
当我尝试加载我使用React Native创建的视图时,我得到错误屏幕,将我引导到运行npm的终端窗口。

I am using React Native as a Pod in my iOS project. When I try to load a view that I created with React Native I get the Error screen referring me to the Terminal window where npm is running.

终端我看到的错误是:
错误:无法在任何根目录中找到条目文件:

In the Terminal the error I am seeing is: Error: Cannot find entry file in any of the roots:

我尝试了一些事情,将文件移动到不同的位置,但没有运气。
我确实运行了npm start,我正在寻找 http:// localhost:8081 / 中的文件。
文件的当前位置与我从npm start运行的位置相同。

I tried a few things, moving the file to a different location, but no luck. I did run "npm start" and I am looking for the file in "http://localhost:8081/". The current location of the file is in the same location as where I ran "npm start" from.

我完全被困在这里。
我配置错误了吗?我怎样才能从这里排除故障?

I am completely stuck here. Did I configure something wrong. How can I troubleshoot from here?

推荐答案

很抱歉回答我自己的问题(有点蹩脚),但我希望它有助于某人否则。

Sorry for answering my own question (a bit lame), but I hope it helps somebody else.

我们需要通过提供替代路径来运行npm命令。

Apperantly we need run the npm command by giving an alternative path.

npm run start -- --root <directory_with_your_react_component_js_sources>

On http://facebook.github.io/react-native/docs/embedded-app.html#content 是如何整合React的指南在现有应用中原生。

On http://facebook.github.io/react-native/docs/embedded-app.html#content is a guide on how to integrate React Native in an existing app.

这篇关于React无法在任何根中找到条目文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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