簡體   English   中英

我如何修復 react-native run-android 首次運行錯誤

[英]how can i fix react-native run-android first run error

當我用 react-native 創建一個項目並運行一個

react-native run-android

構建失敗,如下面的日志所示。 我如何解決它?

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
    (node:29740) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
    (Use `node --trace-warnings ...` to show where the warning was created)
    Jetifier found 879 file(s) to forward-jetify. Using 12 workers...
    info Starting JS server...
    info Installing the app...
    :ReactNative:Unexpected empty result of running '[node, C:\Users\a0105\OneDrive\바탕 ?���?\momentum\AS\node_modules\react-native\node_modules\@react-native-community\cli\build\bin.js, config]' command.
    :ReactNative:Running '[node, C:\Users\a0105\OneDrive\바탕 ?���?\momentum\AS\node_modules\react-native\node_modules\@react-native-community\cli\build\bin.js, config]' command failed.
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script 'C:\Users\a0105\OneDrive\���� ȭ��\momentum\AS\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 213
    
    * What went wrong:
    A problem occurred evaluating script.
    > internal/modules/cjs/loader.js:905  throw err;  ^Error: Cannot find module 'C:\Users\a0105\OneDrive\諛�?�? �솕硫�\momentum\AS\node_modules\react-native\node_modules\@react-native-community\cli\build\bin.js'    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)    at Function.Module._load (internal/modules/cjs/loader.js:746:27)    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)    at internal/main/run_main_module.js:17:47 {  code: 'MODULE_NOT_FOUND',  requireStack: []}
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 3s
    
    error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
    Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
    :ReactNative:Unexpected empty result of running '[node, C:\Users\a0105\OneDrive\바탕 ?���?\momentum\AS\node_modules\react-native\node_modules\@react-native-community\cli\build\bin.js, config]' command.
    :ReactNative:Running '[node, C:\Users\a0105\OneDrive\바탕 ?���?\momentum\AS\node_modules\react-native\node_modules\@react-native-community\cli\build\bin.js, config]' command failed.
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script 'C:\Users\a0105\OneDrive\���� ȭ��\momentum\AS\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 213
    
    * What went wrong:
    A problem occurred evaluating script.
    > internal/modules/cjs/loader.js:905  throw err;  ^Error: Cannot find module 'C:\Users\a0105\OneDrive\諛�?�? �솕硫�\momentum\AS\node_modules\react-native\node_modules\@react-native-community\cli\build\bin.js'    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)    at Function.Module._load (internal/modules/cjs/loader.js:746:27)    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)    at internal/main/run_main_module.js:17:47 {  code: 'MODULE_NOT_FOUND',  requireStack: []}
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 3s
    
        at makeError (C:\Users\a0105\OneDrive\바탕 화면\momentum\AS\node_modules\execa\index.js:174:9)
        at C:\Users\a0105\OneDrive\바탕 화면\momentum\AS\node_modules\execa\index.js:278:16
        at processTicksAndRejections (internal/process/task_queues.js:95:5)
        at async runOnAllDevices (C:\Users\a0105\OneDrive\바탕 화면\momentum\AS\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:106:5)
        at async Command.handleAction (C:\Users\a0105\OneDrive\바탕 화면\momentum\AS\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:192:9)
    info Run CLI with --verbose flag for more details.]

我嘗試了很多方法,但沒有奏效。 使用 expo 執行成功。

當我運行 react-native info 時,會出現下面的日志。

info Fetching system and libraries information...
(node:29320) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
error Unable to print environment info.
Error: Command failed: wmic os get Caption
'wmic'��(��) ���� �Ǵ� �ܺ� ����, ������ �� �ִ� ���α׷�, �Ǵ�
��ġ ������ �ƴմϴ�.

我修理它

檢查 jdk8 和使用物理設備

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM