在Android上运行react-native的运行教程’AwesomeProject’导致’无法下载JS Bundle’红屏
作者:互联网
我正在关注this Facebook教程,并且从AwesomeProject目录运行react-native run-android时,我在android模拟器上显示红屏,并显示以下文本:
Unable to download JS bundle. Did you forget to start the development server or connect your device?
onResponse
DevServerHelper.java:175
run
NamedRunnable.java:33
runWorker
ThreadPoolExecutor.java:1113
run
ThreadPoolExecutor.java:588
run
Thread.java:818
我不知道它是否相关,但是我在服务器上也收到一堆关于const在严格模式下无效的SyntaxErrors(我没有更改原始代码中的任何内容),并且在START上收到以下错误:
< START> request:/index.android.bundle?platform=android
TypeError: Cannot read property ‘root’ of null
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
at tryCallOne (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at process._tickCallback (node.js:355:11)
更新资料
升级到Node v4.1.1摆脱了const语法错误,但是在React Packager上我仍然得到以下错误:
TypeError: Cannot read property ‘root’ of null
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
at tryCallOne (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at process._tickCallback (node.js:355:11)
[5:02:20 PM] request:/index.android.bundle?platform=android
[5:02:20 PM] find dependencies
TypeError: Cannot read property ‘root’ of null
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/packager/react-packager/src/DependencyResolver/crawlers/index.js:16:84
at tryCallOne (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
at /Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/lib/core.js:103:15
at flush (/Users/tome/projects/reactNative/AwesomeProject/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
at process._tickCallback (node.js:355:11)
[5:02:26 PM] request:/index.android.bundle?platform=android
解决方法:
我设法解决了这个问题.对于遇到此问题的其他任何人,重新安装watchman可以帮到我:
brew卸载看守
酿造安装看守
我的应用程序现在正在运行
标签:reactjs,react-native,android-emulator,android 来源: https://codeday.me/bug/20191119/2037976.html