A problem occurred evaluating script. > Command '[node, [PROJECT_PATH]/node_modules/@react-native-community/cli/build/bin.js, config, --platform, android]' failed with exit code 1.
Ask your Question
Similar, but not the same as #2469.
My team and I have been running into this android build issue for a month now and have not been able to come up with a solution. This occurs when we run either a ./gradlew clean or ./gradlew build.
npx react-native info output:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 250.11 MB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.17.1
path: ~/.nvm/versions/node/v18.17.1/bin/node
Yarn:
version: 1.22.21
path: ~/.nvm/versions/node/v18.17.1/bin/yarn
npm:
version: 10.2.0
path: ~/.nvm/versions/node/v18.17.1/bin/npm
Watchman:
version: 2024.09.02.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK:
API Levels:
- "31"
- "33"
- "34"
Build Tools:
- 30.0.3
- 33.0.0
- 33.0.1
- 34.0.0
System Images:
- android-34 | Google APIs ARM 64 v8a
- android-34 | Google Play ARM 64 v8a
- android-35 | Google APIs ARM 64 v8a
- android-35 | Google APIs Intel x86_64 Atom
- android-35 | Google Play ARM 64 v8a
- android-35 | Google Play Intel x86_64 Atom
- android-35 | Google Play Experimental 16k Page Size ARM 64 v8a
- android-35 | Google Play Experimental 16k Page Size Intel x86_64 Atom
- android-35 | Pre-Release 16 KB Page Size Google APIs ARM 64 v8a
- android-35 | Pre-Release 16 KB Page Size Google APIs Intel x86_64 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2023.2 AI-232.10300.40.2321.11668458
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.73.6
wanted: 0.73.6
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Any help with this would be much appreciated, thank you.
+1 Same thing's happening. I read solutions like putting resolutions but didn't help.
All this log says is that the JS script failed, which could be for any number of reasons.
Can you get the script's output (maybe further up in the Gradle output), or run it directly outside of the Gradle build, so we can see what's happening?
node node_modules/@react-native-community/cli/build/bin.js config --platform android
@robhogan I got an error on that command
error: unknown option --platform
Below are some more details from the experienced error. I tried changing the cli version to latest and it's the same, same when going down.
* Where:
Script '<PROJECT_PATH>/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 397
* What went wrong:
A problem occurred evaluating script.
> Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@37846d19] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.
@robhogan @xgenem's description above is what we are receiving as well. Seems as though when @react-native-community/cli/build/bin.js is run we get the error: unknown option --platform.
Agreed as well with the fact that we have tried downgrading the CLI with no different behavior. Do you have any suggestions here?
@robhogan @xgenem It seems as though this might be an issue with the version of react-native not pulling in the fix that is explained here: https://github.com/react-native-community/cli/pull/2470
Seems as though this was found and fixed in @react-native-community/cli v14.0.1: https://github.com/facebook/react-native/pull/46124
Would this be able to be updated for react-native v73.6?
There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
I see this issue is closed, but what was the solution?