Skip to content
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

Getting "Execution failed for task ':app:invokeLibraryCodegen'" when running yarn android inside Fabric View Library #699

Open
1 of 2 tasks
hamdoudhakem opened this issue Nov 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@hamdoudhakem
Copy link

Description

I started a new Blank Library using the Fabric View template, after I ran yarn install in the project root and inside the example folder without changing or doing anything else I ran yarn android and I keep getting this error:
Image

I also tried the Fabric View with backward compatibility template and I got the same error.
I also followed these docs to check if anything was wrong with the template and I didn't find anything: https://github.com/reactwg/react-native-new-architecture/blob/main/docs/fabric-native-components.md

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

Fabric View

Link to repro

https://github.com/hamdoudhakem/react-native-chat-llm

Environment

  • System:
    • OS: Windows 11 10.0.22631
    • CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
    • Memory: 1.73 GB / 15.78 GB
  • Binaries:
    • Node:
      • version: 20.18.0
      • path: C:\Program Files\nodejs\node.EXE
    • Yarn:
      • version: 3.6.1
      • path: ~\AppData\Roaming\npm\yarn.CMD
    • npm:
      • version: 10.9.0
      • path: C:\Program Files\nodejs\npm.CMD
    • Watchman: Not Found
  • SDKs:
    • Android SDK: Not Found
    • Windows SDK: Not Found
  • IDEs:
    • Android Studio: AI-242.21829.142.2421.12409432
    • Visual Studio:
    • 17.11.35327.3 (Visual Studio Community 2022)
  • Languages:
    • Java: 17.0.13
    • Ruby: Not Found
  • npmPackages:
    • "@react-native-community/cli":
      • installed: 15.0.1
      • wanted: 15.0.1
    • react:
      • installed: 18.3.1
      • wanted: 18.3.1
    • react-native:
      • installed: 0.76.3
      • wanted: 0.76.3
    • react-native-windows: Not Found
  • npmGlobalPackages:
    • "react-native": Not Found
  • Android:
    • hermesEnabled: true
    • newArchEnabled: true
  • iOS:
    • hermesEnabled: Not found
    • newArchEnabled: Not found
@hamdoudhakem hamdoudhakem added the bug Something isn't working label Nov 23, 2024
@antoine1anthony
Copy link

Hey, just a thought have you tried downgrading your node version from 20 to 18.

@tri-bao
Copy link

tri-bao commented Nov 25, 2024

I got the same problem with a new Turbo library. I use node 20, the same thing with node 18. In my case, I turned out gradle, somehow, couldn't resolve npx although Nodjs bin folder is in the PATH. You may try to use the absolute path to npx in file

example/android/app/build.gradle At the end of the file,

if (isNewArchitectureEnabled()) {
    // Since our library doesn't invoke codegen automatically we need to do it here.
    tasks.register('invokeLibraryCodegen', Exec) {
        workingDir "$rootDir/../../"

        // I use this command to confirm that node/bin is in the PATH
        commandLine 'env'

        commandLine "npx", "bob", "build", "--target", "codegen"
    }
    preBuild.dependsOn invokeLibraryCodegen
}

I changed it to the absolute path, it worked.

Then, I restarted my PC, turn back to just npx, and ... it also worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants