-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
.xcode.env
file with dynamic node binary path
- Loading branch information
Showing
4 changed files
with
2 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export NODE_BINARY=$(command -v node) |
This file contains 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
This file contains 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
bdd6ab1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting... At the time, I was surprised by facing the need to generate the file at runtime by hardcoding the path to
node
rather than relying oncommand -v node
to compute it.I did that because, despited having the file like this, Xcode was failing to build for me. I added some logs in the script that RN calls to read that file and verified it was because the
export
ed env var was empty.On my machine, this still seems to be happening. Notice the lack of a version in the
export NODE_BINARY=
suggestion. Looking at the source for that message in React Native, it's clear thatcommand -v node
returns an empty value in my setup (despite, of course, working when run on the Terminal)Thankfully, React Native's fallback logic to find the Node version worked this time around, and the build proceeded successfully. (There's a bit of red in the screenshot, but it's due to a different unrelated error that had to do with a dirty local cache)
bdd6ab1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting, I haven't checked to build the XCFramework using Xcode, but I understand I might encounter a similar issue. So far, all the tests I made were in the terminal.
As mentioned here, we follow the same approach in the Gutenberg demo app, so I understand it should also work for this case. In the worst case, we could use the
.xcode.env.local
file to explicitly define thenode
path.bdd6ab1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Let's see if any problem reveals itself down the track