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

[0.64.0] archive fails for release due to invalid check for custom ENTRY_FILE #31282

Closed
Johan-dutoit opened this issue Mar 31, 2021 · 10 comments
Closed
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Johan-dutoit
Copy link
Contributor

Johan-dutoit commented Mar 31, 2021

Description

I have a monorepo setup (using nrwl), that specifies a custom ENTRY_FILE that is used within react-native-xcode.sh script.

This was working fine on 0.63.4, but started failing on 0.64.0.
After further inspection, I found this new check added

https://github.com/facebook/react-native/blob/master/scripts/react-native-xcode.sh#L80-L83

It's not running in the correct context, removing it and everything works fine again.

React Native version:

System:
OS: macOS 11.2.3
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Memory: 2.06 GB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.10.1 - /usr/local/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.8 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK:
API Levels: 23, 26, 27, 28, 29, 30
Build Tools: 23.0.1, 28.0.3, 29.0.2, 29.0.3, 30.0.0, 30.0.1, 30.0.3
System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
Android NDK: 22.0.6917172-beta1
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_181 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.0 => 0.64.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Have a monorepo setup (or custom entry file)
  2. Attempt to create an iOS archive

Expected Results

To archive successfully.

@Johan-dutoit
Copy link
Contributor Author

or potentially revert this PR: https://github.com/facebook/react-native/pull/29012/files

@grabbou
Copy link
Contributor

grabbou commented Apr 6, 2021

The check itself seems quite helpful. Can you share the way you specify your entry file as well as your folder structure and where is the react-native-xcode.sh located in your tree? We will try to update the script to work in this manner.

@Johan-dutoit
Copy link
Contributor Author

@grabbou I totally agree that the check is useful. Is it being run from a different directory compared to where it's actually used?
When I comment out the check, the archive works fine and my bundle is generated as expected, which leads me to believe the context. is different.

As requested

ENTRY_FILE=./apps/mobile/src/main.tsx

Structure

- root (node_modules lives here along with package.json)
   - libs
     - ...
   - apps
     - ...
     - mobile
       - src

@chasepoirier
Copy link

@Johan-dutoit I was facing the same issue the other day in my monorepo. What ended up working for me was to modify my Bundle React Native code and images build phase to look like this:

export NODE_BINARY=node
export EXTRA_PACKAGER_ARGS="--entry-file frontend/mobile-app/index.js"
../../../node_modules/react-native/scripts/react-native-xcode.sh frontend/mobile-app/index.js

This worked without any modifications to the react-native-xcode.sh script

@Johan-dutoit
Copy link
Contributor Author

Thanks @chasepoirier , will give it a go!
The patch-package solution I setup has worked so far, but don't like the idea of modifying the script.

@sobernaut
Copy link

I had the same issue after upgrading react native to version 0.64.1 in a project with monorepo setup. I had the same error message as @Johan-dutoit. I managed to make it work after following exactly what the message said making following changes.

export NODE_BINARY=node
export ENTRY_FILE=mobile/index.tsx
../../node_modules/react-native/scripts/react-native-xcode.sh

I hope this helps.

@nitaliano
Copy link

nitaliano commented Sep 21, 2021

This got both debug and release builds working for me in a monorepo

export NODE_BINARY=node
export EXTRA_PACKAGER_ARGS="--entry-file index.js"

if [[ "$CONFIGURATION" = *Release* ]]; then
  export ENTRY_FILE=<path to index.js from monorepo root>
fi

# Go to monorepo root
cd <monorepo root path>

# Run from root
./node_modules/react-native/scripts/react-native-xcode.sh

@samih7
Copy link

samih7 commented Oct 3, 2021

Thanks @chasepoirier , will give it a go! The patch-package solution I setup has worked so far, but don't like the idea of modifying the script.

@Johan-dutoit Did you give it a go in the end? I am also using a nwrl monorepo and the provided solutions do not seem to help.

whyer added a commit to kolplattformen/skolplattformen that referenced this issue Nov 8, 2021
@stale
Copy link

stale bot commented Jan 9, 2022

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 9, 2022
@github-actions
Copy link

github-actions bot commented Feb 2, 2022

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as completed Feb 2, 2022
@facebook facebook locked as resolved and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

6 participants