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

react-native-macos 0.74.1 fails on fresh project #2165

Closed
hsjoberg opened this issue Aug 15, 2024 · 4 comments
Closed

react-native-macos 0.74.1 fails on fresh project #2165

hsjoberg opened this issue Aug 15, 2024 · 4 comments
Labels
bug Something isn't working Needs: Triage 🔍

Comments

@hsjoberg
Copy link

hsjoberg commented Aug 15, 2024

Environment

react-native -v: 13.6.9
npm ls react-native: 0.74.5
npm ls react-native-macos: 0.74.1
node -v: v21.6.0
npm -v: 10.2.4
yarn --version: 3.6.4
xcodebuild -version: Xcode 15.4 Build version 15F31d

Steps to reproduce the bug

I tried making a fresh project through community cli, and adding react-native-macos to it through react-native-macos-init.
However, building fails with the following error:

telegram-cloud-photo-size-4-5904510091678303136-x

I tried both old and new arch.

Steps to reproduce:

You can find reproducible project here: https://github.com/hsjoberg/rnmacos74

Running through cli (npx react-native-macos run-macos --scheme rnmacos74-macOS --configuration Debug) does unfortunately not give any more useful info from what I can tell. But I uploaded full log here: https://gist.github.com/hsjoberg/0145ebdf2fa5d7ab138c928222f41b09

Expected Behavior

App should successfully build.

Actual Behavior

Getting error Codegen did not run properly in your project. Please reinstall cocoapods with `bundle exec pod install`.

Reproducible Demo

https://github.com/hsjoberg/rnmacos74

Additional context

No response

@hsjoberg hsjoberg added the bug Something isn't working label Aug 15, 2024
@morukutsu
Copy link

From what I have tested, when running npx react-native@latest init test_project3 --version 0.74.1, if you do not install CocoaPods when prompted here ? Do you want to install CocoaPods now? Only needed if you run your project in Xcode directly › (y/N), the build will fail with the error above. Could you try this on your end?

@hsjoberg
Copy link
Author

hsjoberg commented Aug 17, 2024

Okay I think I've figured it out.

There's an erroneous script [CP-User] [RN]Check rncore that runs for the React-Fabric pod.
The script tries to look for codegen files in node_modules/react-native/..., whereas codegen will create them in node_modules/react-native-macos/....

The script:

echo "Checking whether Codegen has run..."
rncorePath="$REACT_NATIVE_PATH/ReactCommon/react/renderer/components/rncore"

if [[ ! -d "$rncorePath" ]]; then
  echo 'error: Codegen did not run properly in your project. Please reinstall cocoapods with `bundle exec pod install`.'
  exit 1
fi

$REACT_NATIVE_PATH will point to react-native, not react-native-macos.
This would also explain why it worked for you @morukutsu when you ran the initial pod install for iOS.

As a quick fix it's possible to just clear out the script and xcode will build the project just fine.
You can find the script in Xcode, under Pods -> React Fabric and then Build Phases.

But the actual proper fix is not clear to me yet.

@Saadnajmi
Copy link
Collaborator

Thanks for the investigation @hsjoberg !

@hsjoberg
Copy link
Author

hsjoberg commented Sep 3, 2024

Closing this one. Seems to not be an issue anymore in react-native-macos@0.75.2 💯

@hsjoberg hsjoberg closed this as completed Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Needs: Triage 🔍
Projects
None yet
Development

No branches or pull requests

3 participants