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
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.
react-native init --template typescript
yarn android
Shebang doesn't work on Windows - really annoying error. Your workaround is a correct fix.
I'll send a PR in a second.
Fixed as of 3.1.1 of cli-platform-android package. Please reinstall node_modules and remove lockfiles.
@tony-tsx, please let me know if it works. What's your command line tool? Powershell? In case you run into any other issues, I'd appreciate your debugging and we will ship fixes right away.
Once you confirm the fix, I will release this to 4.x channel too.
Fixed as of
3.1.1ofcli-platform-androidpackage. Please reinstallnode_modulesand remove lockfiles.@tony-tsx, please let me know if it works. What's your command line tool? Powershell? In case you run into any other issues, I'd appreciate your debugging and we will ship fixes right away.
Thanks. i'm using powershell, i'll be in a minute. Anything notice here.
I tried deleting all my lock files and reinstalling node modules, still getting the same error
@grabbou still running into the same problem, let me know what else I can do to fix this.
@nikhilbatta try verifying that your version of cli-platform-android was updated to 3.1.1. When I just re-installed @react-native-community/cli it installed 3.1.0, I had to explicitly install @react-native-community/[email protected].
@amduffy19 I have the right versioning which is 3.1.1 and its still giving me the same error.
can i see what your packagejson looks like ?
@nikhilbatta are you sure it's the same error?
@sclavijo93
internal/modules/cjs/loader.js:626 throw err; ^Error: Cannot find module '@react-native-community/cli'Require stack:- C:\Users\NikhilBatta\Desktop\throwaway\wellifynative\android[eval] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15) at Function.Module._load (internal/modules/cjs/loader.js:527:27) at Module.require (internal/modules/cjs/loader.js:681:19) at require (internal/modules/cjs/helpers.js:16:16) at [eval]:1:13 at Script.runInThisContext (vm.js:123:20) at Object.runInThisContext (vm.js:313:38) at Object.
([eval]-wrapper:9:26) at Module._compile (internal/modules/cjs/loader.js:774:30) at evalScript (internal/process/execution.js:78:25) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\Users\NikhilBatta\Desktop\throwaway\wellifynative\android\[eval]' ]}
@nikhilbatta That looks like a different error. Try npm install @react-native-community/cli or add @react-native-community/cli to package.json and re-install node-modules
@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 yarn or npm install
(https://stackoverflow.com/questions/60218063/no-such-file-or-directory-open-app-build-intermediates-merged-manifests-debug#)
yup thats the thing that i am trying right now. @sclavijo93
@nikhilbatta That's weird.. that solution is working for me
I think it worked, thank you bros. @amduffy19 @sclavijo93
Nice! You're welcome @nikhilbatta and thanks to you too @amduffy19
@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
@amduffy19
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 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.
Most helpful comment
@sclavijo93 @nikhilbatta I had to downgrade to
[email protected]and included thisand it worked! Thanks guys!