在终端和Visual Studio中运行React App时出错

时间:2019-07-04 18:52:07

标签: react-native

我无法运行任何本机Android应用。

在终端中,该应用程序似乎已启动,但随后我无法加载脚本。确保您正在运行Metro服务器错误。

在Visual Studio中,我得到的错误如下:

Installing the app...
> Task :app:generatePackageList
> Task :app:preBuild
> Task :app:bundleDebugJsAndAssets SKIPPED
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugResources UP-TO-DATE
> Task :app:compileDebugJavaWithJavac UP-TO-DATE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders UP-TO-DATE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:signingConfigWriterDebug UP-TO-DATE
> Task :app:mergeDebugAssets UP-TO-DATE
> Task :app:copyDebugBundledJs SKIPPED
> Task :app:checkDebugDuplicateClasses UP-TO-DATE
> Task :app:transformClassesWithDexBuilderForDebug UP-TO-DATE
> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug UP-TO-DATE
> Task :app:transformDexArchiveWithDexMergerForDebug UP-TO-DATE
> Task :app:mergeDebugJniLibFolders UP-TO-DATE
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
> Task :app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
> Task :app:packageDebug UP-TO-DATE

> Task :app:installDebug
07:42:41 V/ddms: execute: running am get-config
07:42:41 V/ddms: execute 'am get-config' on '547aa885' : EOF hit. Read: -1
07:42:41 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'Mi-4c - 7.1.2' for app:debug
07:42:41 D/app-debug.apk: Uploading app-debug.apk onto device '547aa885'
07:42:41 D/Device: Uploading file onto device '547aa885'
07:42:41 D/ddms: Reading file permision of /home/gutas/Desktop/Sproj/sproj/android/app/build/outputs/apk/debug/app-debug.apk as: rw-r--r--
07:42:43 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
07:42:48 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on '547aa885' : EOF hit. Read: -1
07:42:48 V/ddms: execute: returning
07:42:48 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
07:42:48 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on '547aa885' : EOF hit. Read: -1
07:42:48 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.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 13s
27 actionable tasks: 2 executed, 25 up-to-date
info Connecting to the development server...
info Starting the app on "547aa885"...
Starting: Intent { cmp=com.sproj/.MainActivity }
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn vscode ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

这是我使用的版本。

  • react-native-cli:2.0.1
  • 本机:0.60.0
  • 节点:v10.16.0

0 个答案:

没有答案