[ios] Resolve use_react_native!(path) param in react_native_pods.rb from Pathname.pwd#54948
Closed
kitten wants to merge 1 commit intofacebook:mainfrom
Closed
[ios] Resolve use_react_native!(path) param in react_native_pods.rb from Pathname.pwd#54948kitten wants to merge 1 commit intofacebook:mainfrom
use_react_native!(path) param in react_native_pods.rb from Pathname.pwd#54948kitten wants to merge 1 commit intofacebook:mainfrom
Conversation
The `path` argument in `react_native_pods.rb` is not resolved but instead later joined using `File.join(relative_path_from_current, path)`. This doesn't actually resolve the path, meaning, if `path` is absolute it's appended to this first relative path. Instead, we should use `Pathname#join` and join the path to the pathname, guaranteeing it to be absolute, then construct relative paths (for the prefix) using `relative_path_from` against the installation root.
use_react_native!(path) param in reacft_native_pods.rb from Pathname.pwduse_react_native!(path) param in react_native_pods.rb from Pathname.pwd
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D90261384. |
cortinico
approved these changes
Jan 14, 2026
Contributor
cortinico
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Collaborator
|
This pull request was successfully merged by @kitten in 33641f0 When will my fix make it into a release? | How to file a pick request? |
|
@cipolleschi merged this pull request in 33641f0. |
meta-codesync bot
pushed a commit
that referenced
this pull request
Jan 19, 2026
Summary: This is a fix for a regression in #54948 found by Kudo. Passing an absolute path for `react_native_path` was non-functional before and the change was meant to fix this. This however used `Pathname.pwd.join(path)` since I assumed that'd be the intention for a relative path. However, my assumption was that `pod install` would only ever be run in the installation root and hence be equivalent to `Pod::Config.instance.installation_root` most of the time. This broke: `pod install --project-directory ios` (and the likes), since I wasn't aware of the `--project-directory` argument before. To fix this, we should construct the absolute path and join from `Pod::Config.instance.installation_root` as well. **Note to self:** Needs a pick into `0.84.0` due to being a regression (will file a pick request after this is merged) ## Changelog: [IOS] [FIXED] Regression from #54948 preventing `pod install --project-directory` from working properly Pull Request resolved: #55204 Test Plan: - Run `pod install` in `rn-tester` to validate Reviewed By: vzaidman Differential Revision: D90870064 Pulled By: cipolleschi fbshipit-source-id: 4a7bc0320afda29373791f206b31e57ae48b0b8c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Note
This is a bit of a speculative fix that's based on trying to get a bare project with
react-native-macosto link directly against it in an isolated installation, which makes passingpathset torequire.resolve('react-native-macos/package.json')more convenient than constructing a relative path first.The
pathargument inreact_native_pods.rbis not resolved but instead later joined usingFile.join(relative_path_from_current, path). This doesn't actually resolve the path, meaning, ifpathis absolute it's appended to this first relative path.Instead, we should use
Pathname#joinand join the path to the pathname, guaranteeing it to be absolute, then construct relative paths (for the prefix) usingrelative_path_fromagainst the installation root.If we don't do this, the absolute path gets treated as a relative path (e.g.
./Users), which leads to errors such as:Since absolute paths are unambiguous the change should be safe.
Changelog:
[IOS] Allow absolute react-native paths to be passed to
use_react_native!in project podfilesTest Plan:
This can be replicated by replacing
pathin theuse_react_nativecall with an absolute resolution and runningpod installafter, for example:Usually, the
pathargument gets resolved from the react-native-config viaconfig[:reactNativePath]. However, this makes the implicit assumption thatuse_native_modules!has already converted this to a relative path.