Skip to content

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

@evoactivity

Description

@evoactivity

Environment

react-native info output
System:
  OS: macOS 14.2.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 941.36 MB / 64.00 GB
  Shell:
    version: 3.6.0
    path: /opt/homebrew/bin/fish
Binaries:
  Node:
    version: 18.18.0
    path: ~/.volta/tools/image/node/18.18.0/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.volta/tools/image/yarn/1.22.18/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.volta/tools/image/node/18.18.0/bin/npm
  Watchman:
    version: 2024.08.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    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"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-31 | Google TV ARM 64 v8a
      - android-32 | Google APIs ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2412.12266719
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: javac 17
    path: /Users/liam/.jabba/jdk/openjdk@1.17.0/Contents/Home/bin/javac
  Ruby:
    version: 3.3.4
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 14.0.1
    wanted: ^14.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native: Not Found
  react-native-macos: Not Found
  react-native-tvos:
    installed: 0.75.2-0
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Description

I'm seeing a similar problem as #2490 but with a different exit code.

Caused by: org.gradle.api.GradleException: ERROR: autolinkLibrariesFromCommand: process npx @react-native-community/cli config exited with error code: 126

Which usually means a permissions issue. I can run npx @react-native-community/cli config myself with no issues.
This comment #2490 (comment) mentions making rnc-cli executable but mine already is executable.

Same error as this comment facebook/react-native#46134 (comment) but that issue is unrelated so suggested fixes don't work.

When I run the build from android studio it doesn't run into this (but does error about dependencies being built against wrong SDK version so I can't complete a build from there).

I've tried ./gradlew clean but that results in the same error, I've deleted node_modules and lockfile, I've tried looking manually at the cli bin files for permission issues, I've updated android studio, I'm using latest SDK.

I tried running as root and then it was able to build, but that causes a bunch of other issues related to file ownership being owned by root.

Building when running on emulator (from react-native start) works fine and I can work on the app like normal.

This began happening updgrading from 0.73.7 to 0.75.2 (through the react-native-tvos project).

This happens when building using

./gradlew assembleRelease

I'm using volta to manage node versions

Reproducible Demo

I was able to reproduce in a fresh project

$ npx @react-native-community/cli init testproject
$ cd testproject
$ yarn
$ cd android
$ ./gradlew assembleRelease --info --verbose --full-stacktrace    
react-native info output
  System:
  OS: macOS 14.2.1
  CPU: (10) arm64 Apple M1 Max
  Memory: 305.52 MB / 64.00 GB
  Shell:
    version: 3.6.0
    path: /opt/homebrew/bin/fish
Binaries:
  Node:
    version: 18.17.1
    path: ~/.volta/tools/image/node/18.17.1/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.volta/tools/image/yarn/1.22.18/bin/yarn
  npm:
    version: 9.6.7
    path: ~/.volta/tools/image/node/18.17.1/bin/npm
  Watchman:
    version: 2024.08.26.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    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"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-31 | Google TV ARM 64 v8a
      - android-32 | Google APIs ARM 64 v8a
      - android-33 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2412.12266719
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: javac 17
    path: /Users/liam/.jabba/jdk/openjdk@1.17.0/Contents/Home/bin/javac
  Ruby:
    version: 3.3.4
    path: /opt/homebrew/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: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: false

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions