cli: npx react-native run-anroid fails with error autolinkLibrariesFromCommand at '/Users/mac/rn75test/android/settings.gradle' line: 3

Environment

Shell: version: “5.9” path: /bin/zsh Binaries: Node: version: 20.15.1 path: ~/.nvm/versions/node/v20.15.1/bin/node Yarn: version: 1.22.19 path: ~/.nvm/versions/node/v20.15.1/bin/yarn npm: version: 10.7.0 path: ~/.nvm/versions/node/v20.15.1/bin/npm Watchman: version: 2024.08.26.00 path: /usr/local/bin/watchman Managers: CocoaPods: Not Found 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” - “32” - “33” - “34” Build Tools: - 30.0.3 - 33.0.0 - 33.0.1 - 34.0.0 System Images: - android-30 | Google APIs Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: version: 15.4/15F31d path: /usr/bin/xcodebuild Languages: Java: version: 17.0.12 path: /usr/bin/javac Ruby: version: 3.3.4 path: /usr/local/opt/ruby/bin/ruby npmPackages: “@react-native-community/cli”: Not Found react: installed: 18.3.1 wanted: 18.3.1 react-native: installed: 0.75.2 wanted: 0.75.2 react-native-macos: Not Found npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: true newArchEnabled: true iOS: hermesEnabled: true newArchEnabled: true

Description

When npx react-native run-anroid, error occurs as soon. It says error occurs on android/settings.gradle but I haven’t touched the setting file since it was fresh made app from npx @react-native-community/cli init. I tried deleting and installing react-native-community in the node_modules dir but same error happens. The error msg below:

info A dev server is already running for this project on port 8081.
info Installing the app...
8 actionable tasks: 2 executed, 6 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

ERROR: autolinkLibrariesFromCommand: process npx @react-native-community/cli config exited with error code: 1

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/mac/rn75test/android/settings.gradle' line: 3

* What went wrong:
A problem occurred evaluating settings 'android'.
> ERROR: autolinkLibrariesFromCommand: process npx @react-native-community/cli config exited with error code: 1

* 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 5s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
ERROR: autolinkLibrariesFromCommand: process npx @react-native-community/cli config exited with error code: 1 FAILURE: Build failed with an exception. * Where:
Settings file '/Users/mac/rn75test/android/settings.gradle' line: 3 * What went wrong:
A problem occurred evaluating settings 'android'.
> ERROR: autolinkLibrariesFromCommand: process npx @react-native-community/cli config exited with error code: 1 * 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 5s.
info Run CLI with --verbose flag for more details.

Reproducible Demo

  1. npx @react-native-community/cli init and put information.
  2. cd <the-repo-you-created>
  3. npx react-native run-anroid

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 32 (1 by maintainers)

Most upvoted comments

Anyone facing this

  1. Check npx @react-native-community/cli config
  2. Fix chmod +x /Users/[RN-PROJECT-PATH]/node_modules/.bin/rnc-cli

Guys who are looking for solutions to this, then just uninstall node_modules and install the dependencies again. Something strange happens with cli when switching to other branches.

rm -rf node_modules && yarn

I’m also facing this issue with following output of npx @react-native-community/cli config. But chmod +x did the job.

$ npx @react-native-community/cli config
sh: /Users/username/Documents/Project/node_modules/.bin/rnc-cli: Permission denied

@szymonrybczak plz what i do my code is stuck here This is my new Fresh project

`info Opening app on Android… info A dev server is already running for this project on port 8081. info Installing the app…

Task :gradle-plugin:settings-plugin:checkKotlinGradlePluginConfigurationErrors Task :gradle-plugin:shared:checkKotlinGradlePluginConfigurationErrors Task :gradle-plugin:shared:compileKotlin UP-TO-DATE Task :gradle-plugin:shared:compileJava NO-SOURCE Task :gradle-plugin:shared:processResources NO-SOURCE Task :gradle-plugin:shared:classes UP-TO-DATE Task :gradle-plugin:shared:jar Task :gradle-plugin:settings-plugin:compileKotlin UP-TO-DATE Task :gradle-plugin:settings-plugin:compileJava NO-SOURCE Task :gradle-plugin:settings-plugin:pluginDescriptors UP-TO-DATE Task :gradle-plugin:settings-plugin:processResources Task :gradle-plugin:settings-plugin:classes Task :gradle-plugin:settings-plugin:jar 8 actionable tasks: 5 executed, 3 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

ERROR: autolinkLibrariesFromCommand: process cmd /c npx @react-native-community/cli config exited with error code: 1

FAILURE: Build failed with an exception.

  • Where: Settings file ‘C:\Users\lucky\Desktop\HealthCare\android\settings.gradle’ line: 3

  • What went wrong: A problem occurred evaluating settings ‘android’.

ERROR: autolinkLibrariesFromCommand: process cmd /c npx @react-native-community/cli config exited with error code: 1

  • 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 info Run CLI with --verbose flag for more details. ` plz some one plz help me

hey @jacobkim9881! what’s the output of npx @react-native-community/cli config command if you run it in the root directory of your project?

Guys who are looking for solutions to this, then just uninstall node_modules and install the dependencies again. Something strange happens with cli when switching to other branches.

rm -rf node_modules && yarn

This works for me RN 0.75.2 Make sure you clean everything

i have the same issue, but im in windows, how can i fix that?

ERROR: autolinkLibrariesFromCommand: process cmd /c npx @react-native-community/cli config exited with error code: 1

FAILURE: Build failed with an exception.

  • Where: Settings file ‘C:\Users(proyect-name)\android\settings.gradle’ line: 14

  • What went wrong: A problem occurred evaluating settings ‘android’.

ERROR: autolinkLibrariesFromCommand: process cmd /c npx @react-native-community/cli config exited with error code: 1

Running on Android SDK resolved the issue! My Android SDK was old one(2021’s version) so I installed latest one. In my case I think the SDK doesn’t have Android 14 :

requires the Android 14 (UpsideDownCake) SDK in particular