Reputation: 11
I'm newbie at react native, in my first many times trying to run npx react-native run-android
i found the error below:
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\Vitor Hugo\Documents\Programação\Aprendendo-React-Native\CursoFabrica\node_modules@react-native-community\cli\build\bin.js, config]' command. :ReactNative:Running '[node, C:\Users\Vitor Hugo\Documents\Programação\Aprendendo-React-Native\CursoFabrica\node_modules@react-native-community\cli\build\bin.js, config]' command failed.
FAILURE: Build failed with an exception.
Where: Script 'C:\Users\Vitor Hugo\Documents\Programa��o\Aprendendo-React-Native\CursoFabrica\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 413
What went wrong: A problem occurred evaluating script. node:internal/modules/cjs/loader:1078 throw err; ^Error: Cannot find module 'C:\Users\Vitor Hugo\Documents\Programação\Aprendendo-React-Native\CursoFabrica\node_modules@react-native-community\cli\build\bin.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: []}Node.js v18.15.0
So i tried to clean cache deleting node_modules
and package.lock
, but it doesn't work yet. I verified the env variables and they are right:
JAVA_HOME: C:\Program Files\Microsoft\jdk-11.0.18.10-hotspot
ANDROID_HOME: C:\Android\Sdk
Inside Path
:
%ANDROID_HOME%\platform-tools
%ANDROID_HOME%\tools\bin
%ANDROID_HOME%\tools
%ANDROID_HOME%\emulator
I had try to install directly the cli through npm i @react-native-community/cli-platform-android
because I didn't found folder inside node_modules after clean cache, but nothing yet.
I'm grateful for your attetion, if you can please help me.
Edit1: after I posted this I noticed that my JAVA_HOME was wrong, it indicating jdk-19 so I fix this and doesn't work yet, the line o error changed but the same error occurs, follow the new log below:
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\Vitor Hugo\Documents\Programação\Aprendendo-React-Native\CursoFabrica\node_modules@react-native-community\cli\build\bin.js, config]' command. :ReactNative:Running '[node, C:\Users\Vitor Hugo\Documents\Programação\Aprendendo-React-Native\CursoFabrica\node_modules@react-native-community\cli\build\bin.js, config]' command failed.
FAILURE: Build failed with an exception.
Where: Script 'C:\Users\Vitor Hugo\Documents\Programa��o\Aprendendo-React-Native\CursoFabrica\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 389
What went wrong: A problem occurred evaluating script. node:internal/modules/cjs/loader:1078 throw err; ^Error: Cannot find module 'C:\Users\Vitor Hugo\Documents\Programação\Aprendendo-React-Native\CursoFabrica\node_modules@react-native-community\cli\build\bin.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: []}Node.js v18.15.0
Upvotes: 1
Views: 1938
Reputation: 1
It is happening because of your path. Move your project to english-based path
Upvotes: 0