【发布时间】:2017-12-10 04:23:17
【问题描述】:
我正在尝试使用 Windows 7 和 android 设备使用 react native 启动我的 hello world 应用程序。有一个类似的问题here,但我没能让它工作。
到目前为止我运行的命令来设置并导致此问题。
- 创建应用程序:
react-native init helloMe - 已移至根目录 [helloMe]。
react-native run-android - Android 设备设置正常并使用 adb 在 CMD 中显示
- 打开另一个 CMD 窗口然后运行:
react-native start - 又跑
react-native run-android了。 - 手机显示红屏,此错误无法load script from assets index.android.bundle on windows
-
尝试使用步骤 6 中的解决方案修复它会导致另一个错误,这就是我在这里的原因。下面是我的 CMD 日志。
E:\testdir\react_ws\helloMe>react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res Scanning 558 folders for symlinks in E:\testdir\react_ws\helloMe\node_modules (30ms) Scanning 558 folders for symlinks in E:\testdir\react_ws\helloMe\node_modules (20ms) Loading dependency graph, done. Cannot find entry file index.android.js in any of the roots: ["E:\\testdir\\react_ws\\helloMe"] E:\testdir\react_ws\helloMe>
现在,当我尝试使用上述解决方案解决问题时,又遇到了另一个错误。
Cannot find entry file index.android.js in any of the roots: ["E:\\testdir
\\react_ws\\helloMe"]
如果尝试从here 应用此修复程序
npm run start -- --root <directory_with_your_react_component_js_sources>
因为我在项目根目录中运行命令,所以我运行了这个
npm run start -- --root ./ 但它不起作用。
这是我的根项目结构
__tests__ app.json index.ios.js node_modules yarn.lock
android index.android.js ios package.json
我希望我很清楚,任何帮助将不胜感激。设备卡在红屏上并显示 404。
反应原生版本
react-native-cli: 2.0.1
react-native: 0.46.0
【问题讨论】:
-
分享你的 react native 项目骨架
-
您好,您要截图吗?因为我没有改变基本应用程序的任何内容
-
tests_ app.json index.ios.js node_modules yarn.lock android index.android.js ios package.jso
-
是的,我需要截图
-
我已添加图片
标签: react-native