我一直试图在Windows PC上启动basic React Native program并使其运行,但是无法将其加载到通过USB连接的Pixel 3上。我已经将Node.js重新安装到12.13.1。这是我npx react-native run-android
PS C:\Users\davidc\Working\AwesomeProject> npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
* daemon not running; starting now at tcp:5037
* daemon started successfully
info Installing the app...
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :app:installDebug
03:53:33 V/ddms: execute: running am get-config
03:53:33 V/ddms: execute 'am get-config' on '891X0457A' : EOF hit. Read: -1
03:53:33 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Pixel 3 - 10' for app:debug
03:53:33 D/app-debug.apk: Uploading app-debug.apk onto device '891X0457A'
03:53:33 D/Device: Uploading file onto device '891X0457A'
03:53:33 D/ddms: Reading file permision of C:\Users\davidc\Working\AwesomeProject\android\app\build\outputs\apk\debug\app-debug.apk as: rwx------
03:53:34 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
03:53:37 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on '891X0457A' : EOF hit. Read: -1
03:53:37 V/ddms: execute: returning
03:53:37 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
03:53:37 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on '891X0457A' : EOF hit. Read: -1
03:53:37 V/ddms: execute: returning
Installed on 1 device.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 32s
27 actionable tasks: 27 executed
info Connecting to the development server...
8081
info Starting the app on "891X0457A"...
Starting: Intent { cmp=com.awesomeproject/.MainActivity }
PS C:\Users\davidc\Working\AwesomeProject>
这就是我所能做的。我的手机说它无法加载脚本,并确保Metro服务器正在运行或index.android.bundle已正确打包。有什么建议吗?
答案 0 :(得分:0)
我发现我的问题源于Metro,其中包含一些代码,这些代码无法与最新节点版本处理RegExs的方式很好地配合使用。临时解决方案可以是found here。解决此问题后,我就可以运行代码provided here来构建丢失的index.android.bundle。