Skip to content

fix(react-native): fix codegen failing in a pnpm monorepo setup - #45993

Merged
blakef merged 2 commits into
0.74-stablefrom
tido/pnpm/add-missing-glob
Sep 30, 2024
Merged

fix(react-native): fix codegen failing in a pnpm monorepo setup#45993
blakef merged 2 commits into
0.74-stablefrom
tido/pnpm/add-missing-glob

Conversation

@tido64

@tido64tido64 commented Aug 13, 2024

Copy link
Copy Markdown
Collaborator

Summary:

pod install in a pnpm monorepo setup using latest 0.74 fails due to missing glob

% pod install --project-directory=ios
Framework build type is static library
[Codegen] Adding script_phases to React-Codegen.
[Codegen] Generating ios/build/generated/ios/React-Codegen.podspec.json
[!] Invalid `Podfile` file: [!] ~/.local/bin/node ios/../node_modules/react-native/scripts/generate-codegen-artifacts.js -p /~/packages/test-app -o /~/packages/test-app/ios -t ios
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module 'glob'
Require stack:
- /~/node_modules/.store/react-native-virtual-424e699e97/package/scripts/codegen/generate-artifacts-executor.js
- /~/node_modules/.store/react-native-virtual-424e699e97/package/scripts/generate-codegen-artifacts.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (/~/node_modules/.store/react-native-virtual-424e699e97/package/scripts/codegen/generate-artifacts-executor.js:23:14)

Additionally, when building on Android, yargs cannot be found:

% yarn android
info Installing the app...
> Configure project :app
WARNING: The option setting 'android.jetifier.ignorelist=hermes-android' is experimental.
Signing config for 'release' build type not found; reusing debug config
> Task :react-native-webapis_web-storage:generateCodegenSchemaFromJavaScript FAILED
28 actionable tasks: 6 executed, 22 up-to-date
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
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module 'yargs'
Require stack:
- /~/node_modules/.store/@react-native-codegen-virtual-39ff8dcc54/package/lib/cli/combine/combine-js-to-schema-cli.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at require (node:internal/modules/helpers:179:18)

Note that glob is already included in 0.75-stable and main. I've submitted separate PRs for yargs on 0.75-stable and main

Changelog:

[GENERAL] [FIXED] - Fix codegen failing in a pnpm monorepo setup

Test Plan:

Tested this in microsoft/rnx-kit#3290

@facebook-github-botfacebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Microsoft Partner: Microsoft Partner labels Aug 13, 2024
@analysis-bot

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
androidhermesarm64-v8a17,853,412-3,501,444
androidhermesarmeabi-v7an/a--
androidhermesx86n/a--
androidhermesx86_64n/a--
androidjscarm64-v8a21,211,586-3,338,405
androidjscarmeabi-v7an/a--
androidjscx86n/a--
androidjscx86_64n/a--

Base commit: fcd526d
Branch: main

@tido64tido64 changed the title fix(react-native): generate-artifacts-executor.js requires globfix(react-native): fix codegen failing in a pnpm monorepo setupAug 15, 2024
@blakef
blakef merged commit a90a17a into 0.74-stableSep 30, 2024
@blakef
blakef deleted the tido/pnpm/add-missing-glob branch September 30, 2024 15:14
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.p: MicrosoftPartner: MicrosoftPartnerPick Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@tido64@analysis-bot@cortinico@blakef@facebook-github-bot