callstack / react-native-builder-bob

👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets
https://callstack.github.io/react-native-builder-bob/
2.78k stars 184 forks source link

RN 0.76 Vanilla example can't run #662

Closed pnthach95 closed 2 days ago

pnthach95 commented 4 days ago

Description

RN 0.76 just released. At first, I tested with my library but it can't run. Then, I created new library and vanilla example can't run.

Android Vanilla example log:

> Task :app:invokeLibraryCodegen FAILED
ℹ Building target codegen
ℹ Cleaning up previous iOS codegen native code at ios/generated
ℹ Cleaning up previous Android codegen native code at android/generated
✖ 
17 actionable tasks: 17 executed

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 

/Volumes/code/Projects/awesome-library/node_modules/react-native-builder-bob/lib/targets/codegen.js:48
    throw new Error('Failed generate the codegen files.');
          ^

Error: Failed generate the codegen files.
    at build (/Volumes/code/Projects/awesome-library/node_modules/react-native-builder-bob/lib/targets/codegen.js:48:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async buildTarget (/Volumes/code/Projects/awesome-library/node_modules/react-native-builder-bob/lib/index.js:421:7)

Node.js v20.12.1

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:invokeLibraryCodegen'.
> Process 'command 'npx'' finished with non-zero exit value 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 8s
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Volumes/code/Projects/awesome-library/node_modules/react-native-builder-bob/lib/targets/codegen.js:48 throw new Error('Failed generate the codegen files.'); ^ Error: Failed generate the codegen files. at build (/Volumes/code/Projects/awesome-library/node_modules/react-native-builder-bob/lib/targets/codegen.js:48:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async buildTarget (/Volumes/code/Projects/awesome-library/node_modules/react-native-builder-bob/lib/index.js:421:7) Node.js v20.12.1 FAILURE: Build failed with an exception. * What went wrong:
Execution failed for task ':app:invokeLibraryCodegen'.
> Process 'command 'npx'' finished with non-zero exit value 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 8s.
info Run CLI with --verbose flag for more details.

iOS Vanilla example log:

ℹ Building target codegen
ℹ Cleaning up previous iOS codegen native code at ios/generated
ℹ Cleaning up previous Android codegen native code at android/generated
✖ 
/Volumes/code/Projects/awesome-library/node_modules/react-native-builder-bob/lib/targets/codegen.js:48
    throw new Error('Failed generate the codegen files.');
          ^

Error: Failed generate the codegen files.
    at build (/Volumes/code/Projects/awesome-library/node_modules/react-native-builder-bob/lib/targets/codegen.js:48:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async buildTarget (/Volumes/code/Projects/awesome-library/node_modules/react-native-builder-bob/lib/index.js:421:7)

EDIT: Workaround is open node_modules/react-native-builder-bob/lib/targets/codegen.js and make change

-    await (0, _spawn.spawn)('npx', ['react-native', 'codegen'], {
+    await (0, _spawn.spawn)('npx', ['@react-native-community/cli', 'codegen'], {

Packages

Selected options

✔ What is the name of the npm package? … react-native-awesome-library ✔ What is the description for the package? … test rn76 ✔ What is the name of package author? … Pham Ngoc Thach ✔ What is the email address for the package author? … thachxyz123@gmail.com ✔ What is the URL for the package author? … https://github.com/pnthach95 ✔ What is the URL for the repository? … https://github.com/pnthach95/react-native-awesome-library ✔ What type of library do you want to develop? › Turbo module with backward compat ✔ Which languages do you want to use? › Kotlin & Objective-C ✔ What type of example app do you want to create? › Vanilla

Link to repro

https://github.com/pnthach95/react-native-awesome-library

Environment

OS: macOS 15.0.1 CPU: (8) arm64 Apple M1 Node: version: 20.12.1 path: ~/.nvm/versions/node/v20.12.1/bin/node Yarn: version: 3.6.4 path: ~/.nvm/versions/node/v20.12.1/bin/yarn npm: version: 10.8.2 path: ~/.nvm/versions/node/v20.12.1/bin/npm

itsramiel commented 3 days ago

Same here