cli icon indicating copy to clipboard operation
cli copied to clipboard

Fresh React Native Project Failing: autolinkLibrariesFromCommand Error

Open DEveL0perLuckY opened this issue 1 year ago • 2 comments

Discussed in https://github.com/react-native-community/cli/discussions/2526

Originally posted by DEveL0perLuckY October 14, 2024

Problem Description

I am facing issues while creating a fresh React Native project. The error occurs during the autolinking process:

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

This error appears when running the project, and the build fails with the following details:

Settings file:
C:\Users\lucky\Desktop\HealthCare\android\settings.gradle (line: 3)

Error Message:

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 14s
info Run CLI with --verbose flag for more details.

Attempts to Resolve the Issue

  1. Tried Using an Older Version:

    • When using an older version of React Native, I encountered a similar issue:
      :ReactNative:Running '[node, C:\Users\lucky\Desktop\newproject\node_modules\@react-native-community\cli\build\bin.js, config]' command failed.
      
      FAILURE: Build failed with an exception.
      
      * Where:
      Script 'C:\Users\lucky\Desktop\newproject\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 401
      
      * What went wrong:
      A problem occurred evaluating script.
      > Process 'command 'node'' finished with non-zero exit value 1
      
      BUILD FAILED in 8s
      
  2. Development Environment Setup:

    • I have verified my development environment setup using:
      npx react-native doctor
      
    • No major issues were found with the setup.

Additional Details

  • React Native Version: Tried with both v0.74.2 and v0.75.4
  • Error on Latest Version: The same error (autolinkLibrariesFromCommand failure) occurs on the latest version.
  • OS: Windows

Any suggestions for resolving this issue would be greatly appreciated. image

DEveL0perLuckY avatar Oct 14 '24 07:10 DEveL0perLuckY

Use expo, react native cli is dead!

pranay202 avatar Oct 19 '24 10:10 pranay202

What’s returned when you run the command listed there: node C:\Users\lucky\Desktop\newproject\node_modules\@react-native-community\cli\build\bin.js config

thymikee avatar Oct 19 '24 11:10 thymikee

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.

github-actions[bot] avatar Jan 18 '25 03:01 github-actions[bot]

Fresh React Native Project Failing: autolinkLibrariesFromCommand Error – Solution If you're facing this issue while using the latest or an older version of React Native for Android app development, follow these steps: Steps to Fix:

  1. Restart your system
  2. Delete the .gradle folder at:
  • C:\Users\USERNAME\.gradle
  • <projectName>/android/.gradle
  1. Delete the node_modules folder

  2. Run: npm install (Ensure all dependencies are compatible and not deprecated.)

  3. Run your project: npx react-native run-android

For detailed steps, refer to this document: Fix Guide

DEveL0perLuckY avatar Jan 25 '25 17:01 DEveL0perLuckY