Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Merged
merged 2 commits into from
Sep 30, 2024

Conversation

tido64
Copy link
Collaborator

@tido64 tido64 commented Aug 13, 2024

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

@tido64 tido64 requested a review from cipolleschi August 13, 2024 07:23
@facebook-github-bot facebook-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

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 17,853,412 -3,501,444
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 21,211,586 -3,338,405
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: fcd526d
Branch: main

@tido64 tido64 changed the title fix(react-native): generate-artifacts-executor.js requires glob fix(react-native): fix codegen failing in a pnpm monorepo setup Aug 15, 2024
@blakef blakef merged commit a90a17a into 0.74-stable Sep 30, 2024
61 checks passed
@blakef blakef deleted the tido/pnpm/add-missing-glob branch September 30, 2024 15:14
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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 Pick Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants