Execution failed for task ':react-native-gesture-handler:buildCodegenCLI' + Building with Monorepo
See original GitHub issueDescription
I can’t seem to build react-native-gesture-handler with my monorepo setup. I get the following error:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-gesture-handler:buildCodegenCLI'.
> A problem occurred starting process 'command '/Users/redacted/Desktop/Git_Repo/janus/packages/testapp/node_modules/react-native-codegen/scripts/oss/build.sh''
Looking at my workspace, all the packages are in the node-modules on the root folder. However, codegen CLI is looking for the scripts in the workspace node_modules folder instead of the root node_modules. See image below:
Steps to reproduce
- Configure a mono repo with workspaces
- Use react-native-gesture-handler in one of the workspaces
- Build the project
Snack or a link to a repository
Private Repo
Gesture Handler version
2.7.1
React Native version
0.70.4
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
Android emulator
Device model
No response
Acknowledgements
Yes
Issue Analytics
- State:
- Created a year ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
EAS build in monorepo failure (Failed to construct transformer ...
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings 1 actionable task: 1 executed Error: Gradle ...
Read more >Conditional build of subproject within a monorepo depending ...
You probably want to test and build just frontend if no files ... A Task in a Pipeline to be executed only if...
Read more >The Case for Monorepos: A sane Workspace Setup (Part 2)
Learn how to setup dev tooling in a monorepo, run tasks efficiently, ... would simply not build or produce an error at runtime,...
Read more >A Guide to Monorepos for Front-end Code - Toptal
With yarn workspaces (and by extension, Lerna) it's the same: executing a build from the monorepo/workspace root should trigger package-b's build script first ......
Read more >What is monorepo? (and should you use it?) - Semaphore CI
“Having all the code in one repository helped us reduce the feedback loop [in our build systems].” For Pinterest, a monorepo layout provided...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This seems to be more of a problem with the codegen itself. The code snippet you’ve highlighted is kind of problematic, but it would fail only in cases where
react-native-gesture-handler
is higher in the directory structure thanreact-native
itself, which doesn’t seem to be the case here.In case you’re using a custom setup, you are able to set the paths to relevant packages in your
build.gradle
like so:The problem with that is the fact that React Gradle Plugin is also used by the libraries on the new architecture in order to trigger codegen. Because of this, the custom paths are only applied to the root project instead of all projects using the plugin. If all your packages are on the same level, you could use something like this:
to set the same paths for all projects using the plugin. Otherwise you may need to take a more granular approach and set the paths per package depending on whether it’s being hoisted or not.
No problem, great to see that you were able to solve the problem. I’ll close the issue since you’ve resolved the problems with codegen.