-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR: autolinkLibrariesFromCommand: process npx @react-native-community/cli config exited with error code: 126 #2498
Comments
Building with |
Downgrading from gradle 8.8 to 8.7 seems to have fixed things but I also had it working on 8.8 somehow, and then it broke again, so I'll see how long this keeps working. I had upgraded gradle to 8.8 following the upgrade helper diff |
Well that didn't last long, tried another build after working on the app and the same error has returned. Running |
I believe this issue is related to the new version. Last night, a friend and I spent a considerable amount of time troubleshooting, and after extensive efforts, my friend suggested that we try creating the project using the following command: npx @react-native-community/cli@latest init ProjectName --version 0.74.5 After creating the project with this command, the issue was successfully resolved. |
I just ran into the same issue. |
@winterdouglas what OS are you using? |
MacOS Sonoma (14.6.1) |
@winterdouglas in your case does it also happen in fresh projects? |
Hm, I haven't tried that before, but doing it now worked right away for a new project. |
Sounds very similar to my trouble with it since upgrading to v0.75.2 (but I'm getting 127 error code): #2484 |
I am also getting same Error in using any new module when I download any new module it show the error ERROR: autolinkLibrariesFromCommand: process cmd /c npx @react-native-community/cli config exited with error code: 1. Can any one suggest how to solve this |
@cripttion an easy workaround is to do |
@birdofpreyru I am using Windows OS can you give any suggestion for this. |
@cripttion sure, don't use Windows for RN (nor for any other non-Windows) development 🤣 |
I added the package attribute to the AndroidManifest.xml Updated my project dependencies by adding @react-native-community/cli: "@react-native-community/cli": "^14.1.1" Navigated to the Android folder and ran the following Gradle commands to stop and clean the build: ./gradlew -stop |
I faced this issue, too. I could run my app without any issue yesterday though. P.S. adirimia92's suggestion worked for me. Thank you. |
It looks like permissions issue as I did the same: and the build started without the reported error... |
I just ran these two commands for gradle and it worked without the other changes 👍 In the process though I also updated Android Studio, updated all SDKs, deleted node_modules and reinstalled. Hopefully none of those things you'll need to repeat. |
Using Node 20 solve my issue |
./gradlew clean is giving me the same error: ERROR: autolinkLibrariesFromCommand: process npx @react-native-community/cli config exited with error code: 1 FAILURE: Build failed with an exception.
BUILD FAILED in 1s |
Worked Like a Magic! |
我遇到了同样的问题 |
Guys who are looking for solutions to this, then just uninstall node_modules and install the dependencies again.
|
a new project really works, but when copying the android folders, etc. from the new architecture to try to keep the old project updated, it simply doesn't work, that's crazy. |
sameProblem...when i have added some packages and rebuild the project, it failed, with code 1, it confused me for 2 hours... |
Here it was a permissions problem, I even found a topic saying how to remove the node_modules folder and reinstall, with that working |
It seems like the original node_modules packages works fine, but the third-party can't,and there must be something wrong with the auto link function, could i add my packages manually?(though it might be tedious)or there is a better way to solve the permission problem? |
I uninstalled the old version and install the latest version of react-native-community/cli, as for the config problem , i ran it isolatedly and found that the android/app/main/AndroidManifest.xml don't have my package name, so i add it like this:,and the config command worked,so did the npx react-native start for the moment... |
As Paurox mentioned, the package name/namespace seems to affect this issue. I had also encountered this issue multiple times so far, and the cause seems to alter everytime. The main problem, as the error mentioned, is that The permission issue can be ressolved by using // If using .gradle.kts files:
extensions.configure<com.facebook.react.ReactSettingsExtension> {
// https://reactnative.dev/docs/integration-with-existing-apps?language=kotlin#configuring-gradle
// have to update the path for it to run
autolinkLibrariesFromCommand(
workingDirectory = file("../../existing/"), <- here point to the react native folder
lockFiles = files("../../existing/package-lock.json", "../../existing/package.json") <- provide lock files here
)
} See the whole settings.gradle Also, make sure the node version is up to date, I had node 16 previously, so it worked until it didn't. Try the good old remove |
Environment
react-native info output
Description
I'm seeing a similar problem as #2490 but with a different exit code.
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
I'm using volta to manage node versions
Reproducible Demo
I was able to reproduce in a fresh project
react-native info output
The text was updated successfully, but these errors were encountered: