Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

iOS Codegen fails to find react-native.config.js #34894

Closed
krystofwoldrich opened this issue Oct 7, 2022 · 0 comments
Closed

iOS Codegen fails to find react-native.config.js #34894

krystofwoldrich opened this issue Oct 7, 2022 · 0 comments
Labels
Needs: Triage 🔍 Platform: iOS iOS applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@krystofwoldrich
Copy link
Contributor

Description

When I want to generate codegen for ios during development I've noticed the react-native.config.js is not found.

Version

0.70.2

Output of npx react-native info

info Fetching system and libraries information...
System:
OS: macOS 12.6
CPU: (10) x64 Apple M1 Pro
Memory: 35.47 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 14.20.1 - ~/.volta/tools/image/node/14.20.1/bin/node
Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
npm: 6.14.17 - ~/.volta/tools/image/node/14.20.1/bin/npm
Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/lib/ruby/gems/2.7.0/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8815526
Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
Languages:
Java: 11.0.16 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^17.0.0 => 17.0.2
react-native: ^0.70.0 => 0.70.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

  1. Create new react-native app
  2. Add codegen enabled manually linked library that is not part of package.json, but is added to react-native.config.js
  3. Run
node node_modules/react-native/scripts/generate-artifacts.js --path <sample-new-architecture> --outputPath codegen

Snack, code example, screenshot, or link to a repository

Error

 ~/repos/sentry-react-native   krystofwoldrich/multipleRNsamples ± node node_modules/react-native/scripts/generate-artifacts.js --path sample-new-architecture --outputPath codegen
[Codegen] Processing react-native core libraries
[Codegen] Found react-native


[Codegen] >>>>> Searching for codegen-enabled libraries in /Users/krystofwoldrich/repos/sentry-react-native/node_modules


[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
Error: Cannot find module 'sample-new-architecture/react-native.config.js'
Require stack:
- /Users/krystofwoldrich/repos/sentry-react-native/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js
- /Users/krystofwoldrich/repos/sentry-react-native/node_modules/react-native/scripts/generate-artifacts.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at handleLibrariesFromReactNativeConfig (/Users/krystofwoldrich/repos/sentry-react-native/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:222:22)
    at findCodegenEnabledLibraries (/Users/krystofwoldrich/repos/sentry-react-native/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:436:3)
    at Object.execute (/Users/krystofwoldrich/repos/sentry-react-native/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js:514:23)
    at Object.<anonymous> (/Users/krystofwoldrich/repos/sentry-react-native/node_modules/react-native/scripts/generate-artifacts.js:64:10)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/krystofwoldrich/repos/sentry-react-native/node_modules/react-native/scripts/codegen/generate-artifacts-executor.js',
    '/Users/krystofwoldrich/repos/sentry-react-native/node_modules/react-native/scripts/generate-artifacts.js'
  ]
}


[Codegen] Done.

Proposed fix output:

 ~/repos/sentry-react-native   krystofwoldrich/multipleRNsamples ± node node_modules/react-native/scripts/generate-artifacts.js --path sample-new-architecture --outputPath codegen
[Codegen] Processing react-native core libraries
[Codegen] Found react-native


[Codegen] >>>>> Searching for codegen-enabled libraries in /Users/krystofwoldrich/repos/sentry-react-native/node_modules


[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
cwd /Users/krystofwoldrich/repos/sentry-react-native
rnConfigFilePath sample-new-architecture/react-native.config.js
rnConfigFilePath - resolved /Users/krystofwoldrich/repos/sentry-react-native/sample-new-architecture/react-native.config.js
[Codegen] Found @sentry/react-native


[Codegen] >>>>> Searching for codegen-enabled libraries in the app


[Codegen] >>>>> Processing FBReactNativeSpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/FBReactNativeSpecrHeknw/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios


[Codegen] >>>>> Processing rncore
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rncorehCjmlJ/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios


[Codegen] >>>>> Processing RNSentrySpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/RNSentrySpectMmDpf/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios


>>>>> Creating component provider
Generated schema list: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rn-tmp-schema-list.json
Generated provider in: codegen/build/generated/ios


[Codegen] Done.
@krystofwoldrich krystofwoldrich added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Oct 7, 2022
@react-native-bot react-native-bot added the Platform: iOS iOS applications. label Oct 7, 2022
dmytrorykun pushed a commit that referenced this issue Oct 19, 2022
Summary:
Resolves #34894

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General][Fixed] - Load react-native.config.js from correct path during codegen

Pull Request resolved: #34895

Test Plan:
Command line output after fix with extra console logs to show the correctness ( hopefully :) ) of the fix.

```bash
 ~/repos/sentry-react-native � � krystofwoldrich/multipleRNsamples ± �node node_modules/react-native/scripts/generate-artifacts.js --path sample-new-architecture --outputPath codegen
[Codegen] Processing react-native core libraries
[Codegen] Found react-native

[Codegen] >>>>> Searching for codegen-enabled libraries in /Users/krystofwoldrich/repos/sentry-react-native/node_modules

[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
cwd /Users/krystofwoldrich/repos/sentry-react-native
rnConfigFilePath sample-new-architecture/react-native.config.js
rnConfigFilePath - resolved /Users/krystofwoldrich/repos/sentry-react-native/sample-new-architecture/react-native.config.js
[Codegen] Found sentry/react-native

[Codegen] >>>>> Searching for codegen-enabled libraries in the app

[Codegen] >>>>> Processing FBReactNativeSpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/FBReactNativeSpecrHeknw/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

[Codegen] >>>>> Processing rncore
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rncorehCjmlJ/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

[Codegen] >>>>> Processing RNSentrySpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/RNSentrySpectMmDpf/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

>>>>> Creating component provider
Generated schema list: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rn-tmp-schema-list.json
Generated provider in: codegen/build/generated/ios

[Codegen] Done.
```

Reviewed By: rshest

Differential Revision: D40177746

Pulled By: rshest

fbshipit-source-id: 970f016db26fda003ee3b47d50e80549fdb88415
brentvatne pushed a commit to expo/react-native that referenced this issue Oct 28, 2022
Summary:
Resolves facebook#34894

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General][Fixed] - Load react-native.config.js from correct path during codegen

Pull Request resolved: facebook#34895

Test Plan:
Command line output after fix with extra console logs to show the correctness ( hopefully :) ) of the fix.

```bash
 ~/repos/sentry-react-native � � krystofwoldrich/multipleRNsamples ± �node node_modules/react-native/scripts/generate-artifacts.js --path sample-new-architecture --outputPath codegen
[Codegen] Processing react-native core libraries
[Codegen] Found react-native

[Codegen] >>>>> Searching for codegen-enabled libraries in /Users/krystofwoldrich/repos/sentry-react-native/node_modules

[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
cwd /Users/krystofwoldrich/repos/sentry-react-native
rnConfigFilePath sample-new-architecture/react-native.config.js
rnConfigFilePath - resolved /Users/krystofwoldrich/repos/sentry-react-native/sample-new-architecture/react-native.config.js
[Codegen] Found sentry/react-native

[Codegen] >>>>> Searching for codegen-enabled libraries in the app

[Codegen] >>>>> Processing FBReactNativeSpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/FBReactNativeSpecrHeknw/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

[Codegen] >>>>> Processing rncore
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rncorehCjmlJ/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

[Codegen] >>>>> Processing RNSentrySpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/RNSentrySpectMmDpf/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

>>>>> Creating component provider
Generated schema list: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rn-tmp-schema-list.json
Generated provider in: codegen/build/generated/ios

[Codegen] Done.
```

Reviewed By: rshest

Differential Revision: D40177746

Pulled By: rshest

fbshipit-source-id: 970f016db26fda003ee3b47d50e80549fdb88415
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this issue May 22, 2023
Summary:
Resolves facebook#34894

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General][Fixed] - Load react-native.config.js from correct path during codegen

Pull Request resolved: facebook#34895

Test Plan:
Command line output after fix with extra console logs to show the correctness ( hopefully :) ) of the fix.

```bash
 ~/repos/sentry-react-native � � krystofwoldrich/multipleRNsamples ± �node node_modules/react-native/scripts/generate-artifacts.js --path sample-new-architecture --outputPath codegen
[Codegen] Processing react-native core libraries
[Codegen] Found react-native

[Codegen] >>>>> Searching for codegen-enabled libraries in /Users/krystofwoldrich/repos/sentry-react-native/node_modules

[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
cwd /Users/krystofwoldrich/repos/sentry-react-native
rnConfigFilePath sample-new-architecture/react-native.config.js
rnConfigFilePath - resolved /Users/krystofwoldrich/repos/sentry-react-native/sample-new-architecture/react-native.config.js
[Codegen] Found sentry/react-native

[Codegen] >>>>> Searching for codegen-enabled libraries in the app

[Codegen] >>>>> Processing FBReactNativeSpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/FBReactNativeSpecrHeknw/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

[Codegen] >>>>> Processing rncore
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rncorehCjmlJ/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

[Codegen] >>>>> Processing RNSentrySpec
[Codegen] Generated schema: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/RNSentrySpectMmDpf/schema.json
[Codegen] Generated artifacts: codegen/build/generated/ios

>>>>> Creating component provider
Generated schema list: /var/folders/tl/jddrmdy97gj0cljrcwb_qkzc0000gn/T/rn-tmp-schema-list.json
Generated provider in: codegen/build/generated/ios

[Codegen] Done.
```

Reviewed By: rshest

Differential Revision: D40177746

Pulled By: rshest

fbshipit-source-id: 970f016db26fda003ee3b47d50e80549fdb88415
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Platform: iOS iOS applications. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants