Cannot run program "\node_modules\@react-native-community\cli\build\bin.js": CreateProcess error=193, %1 nÒo Ú um aplicativo Win32 vßlido
Environment
System: OS: Windows 10 10.0.17763 CPU: (4) x64 Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz Memory: 610.45 MB / 7.90 GB Binaries: Node: 13.5.0 - C:\Program Files\Bins\node-v13.5.0-win-x64\node.EXE Yarn: 1.20.0-20190930.1131 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.13.4 - C:\Program Files\Bins\node-v13.5.0-win-x64\npm.CMD SDKs: Android SDK: API Levels: 22, 23, 26, 27, 28, 29 Build Tools: 28.0.3, 29.0.2 System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom IDEs: Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5977832 npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5
Description
new project using react-native-cli I came across an error:
: ReactNative: Running 'PROJECT_DIR \node_modules@react-native-community\cli\build\bin.js config' command failed.
FAILURE: Build failed with an exception.
-
Where: Script 'PROJECT_DIR\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 160
-
What went wrong: A problem occurred evaluating script.
Cannot run program "PROJECT_DIR\node_modules@react-native-community\cli\build\bin.js": CreateProcess error = 193,% 1 is not a valid Win32 application
As the error itself accuses. has a 'PROJECT_DIR\node_modules@react-native-community\cli-platform-android\native_modules.gradle' failure, when it attempts to run 'PROJECT_DIR\node_modules@react-native-community\cli\build\bin.js config' by Runtime.getRuntime().exec in .gradle
got a result by doing a jerry-rigged checking if the command being passed to
getCommandOutput (String command)
is the same as 'PROJECT_DIR\node_modules\@react-native-community\cli\build\bin.js config', and if true then the def cmdProcess variable would receive Runtime.getRuntime().exec ("node" + command)
cmdProcess = Runtime.getRuntime().exec ("node" + command)
if not by default Runtime.getRuntime().exec(command). At first it was a solution but nothing correct.
@react-native-community\cli-platform-android\native_modules.gradle line 154
In other words, when the command is being passed, it is not being executed with nodejs, but tried to execute the file by itself in the system.
I would like to report this.
Note: I apologize for the informality, it is the first time that I make an issue if I have a mistake I apologize and I will be listening to any comments.
def cmdProcess
if ( command.contentEquals( "PROJECT_DIR\\node_modules\\@react-native-community\\cli\\build\\bin.js config" ) ) cmdProcess = Runtime.getRuntime().exec( "node " + command )
else cmdProcess = Runtime.getRuntime().exec(command)
Note: I used google translate.
Reproducible Demo
react-native init --template typescript yarn android
@nikhilbatta that's the same error I'm working on... will let you know if I figure it out
@amduffy19 it ran once for me, everything built fine, im working with aws amplify right now, so when it built i got a config error for that, and then i changed one files name, and then got that error that i just commented about.
im getting this error now, after i ran gradle clean i got this. such file or directory, open 'app\build\intermediates\merged_manifests\debug\AndroidManifest.xml
@nikhilbatta 🤔 I've fixed that error with this too
@nikhilbatta try deleting both node_modules and your .lock file then add this to your package.json
"resolutions": { "@react-native-community/cli-platform-android": "2.9.0" },then run
yarnornpminstall(https://stackoverflow.com/questions/60218063/no-such-file-or-directory-open-app-build-intermediates-merged-manifests-debug#)
@sclavijo93 yeah, i feel it, that fixed it for me too, and then it broke again after i changed the name of my aws-exports file to ts from js
@sclavijo93 @nikhilbatta I had to downgrade to [email protected] and included this
"resolutions": { "@react-native-community/cli-platform-android": "2.9.0" },
and it worked! Thanks guys!
You're welcome! Please, upvote the answer of Adrian So in stackoverflow
That error is now fixed, apologies for the small inconvenience.
@nikhilbatta this https://github.com/react-native-community/cli/issues/965#issuecomment-586056000 is a bit different issue.
Can you open a separate issue to track this down? Let me know your directory setup, environment and versions.
That error is now fixed, apologies for the small inconvenience.
the error has been corrected. It's working now. Sorry for the delay to answer.
FYI the issue described by @nikhilbatta is this: https://github.com/react-native-community/cli/issues/406 and fixed in the latest version.