【发布时间】:2021-07-05 05:13:11
【问题描述】:
我想运行 React Native 项目。我已经尝试过这个命令; npx react-native run-android 和。我试图解决所有错误,但仍然无法运行该项目。这是错误输出。
PS C:\Users\batuh\OneDrive\Masaüstü\native\androidApp> npx react-native run-android info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 903 file(s) to forward-jetify. Using 8 workers... info Starting JS server... info Launching emulator... info Successfully launched emulator. info Installing the app... :ReactNative:Unexpected empty result of running '[node, C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli\build\bin.js, config]' command. :ReactNative:Running '[node, C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli\build\bin.js, config]' command failed. FAILURE: Build failed with an exception. * Where: Script 'C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 205 * What went wrong: A problem occurred evaluating script. node:internal/modules/cjs/loader:927 throw err; ^Error: Cannot find module 'C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli\build\bin.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15) at Function.Module._load (node:internal/modules/cjs/loader:769:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module: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\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli\build\bin.js, config]' command. :ReactNative:Running '[node, C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli\build\bin.js, config]' command failed. FAILURE: Build failed with an exception. Script 'C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 205 * What went wrong: A problem occurred evaluating script. node:internal/modules/cjs/loader:927 throw err; ^Error: Cannot find module 'C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli\build\bin.js' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15) at Function.Module._load (node:internal/modules/cjs/loader:769:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requi * 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\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\execa\index.js:174:9) at C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\execa\index.js:278:16 at processTicksAndRejections (node:internal/process/task_queues:94:5) at async runOnAllDevices (C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5) at async Command.handleAction (C:\Users\batuh\OneDrive\Masaüstü\native\androidApp\node_modules\@react-native-community\cli\build\index.js:186:9) info Run CLI with --verbose flag for more details.
【问题讨论】:
-
我只是猜测有用的消息布局 - 请不要犹豫,在代码围栏之间重新开始复制和粘贴(只有
~~~的行)。
标签: javascript node.js react-native android-studio react-native-android