jhugman / uniffi-bindgen-react-native

A uniffi bindings generator for calling Rust from react-native
https://jhugman.github.io/uniffi-bindgen-react-native/
Other
50 stars 5 forks source link

create-react-native-library: Failed generate the codegen file #138

Closed boek closed 3 weeks ago

boek commented 4 weeks ago

first time setting up a react native build on this machine following the getting started guide and ran into this error

/Users/jboek/Developer/tmp/rnrust/my-rust-lib/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 (/Users/jboek/Developer/tmp/rnrust/my-rust-lib/node_modules/react-native-builder-bob/lib/targets/codegen.js:48:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async buildTarget (/Users/jboek/Developer/tmp/rnrust/my-rust-lib/node_modules/react-native-builder-bob/lib/index.js:421:7)

Was able to get past it by adding "@react-native-community/cli": "latest", to my devDependencies in the project. We may want to either call this out as a dependency to install globally or include it in the devDependencies in the template.

Johennes commented 4 weeks ago

This is interesting because in https://github.com/unomed-dev/react-native-matrix-sdk/blob/main/yarn.lock#L10774 (which was generated with create-react-native-library) I'm getting this package as a direct dependency of react-native itself. 🤔

Could you maybe double check your yarn.lock file to see if there's really nothing else that would already pull this in?

jhugman commented 4 weeks ago

This may be related to https://github.com/callstack/react-native-builder-bob/issues/662 , reported earlier today.

Johennes commented 4 weeks ago

Oh, great find! Unfortunately, running into regressions when integrating the various tools in the RN ecosystem is a somewhat common annoyance in my experience. 😞

Maybe we could try to pin the RN version in the guide?

atlj commented 4 weeks ago

FYI: https://github.com/callstack/react-native-builder-bob/pull/665

The fix is to add "@react-native-community/cli": "15.0.0-alpha.2", or with the version you desire to the root package's devDependencies.

jhugman commented 3 weeks ago

This appears to be fixed; thank you @atlj .

atlj commented 3 weeks ago

Out of context:

This project looks pretty interesting. If you have any other problems with CRNL or builder bob, please feel free to ping me.

jhugman commented 3 weeks ago

This project looks pretty interesting. If you have any other problems with CRNL or builder bob, please feel free to ping me.

Sure thing! Thank you for everything you do!