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 0.64 is not following NODE_BINARY env setting in Xcode #31260

Closed
gnattu opened this issue Mar 28, 2021 · 6 comments
Closed

React Native 0.64 is not following NODE_BINARY env setting in Xcode #31260

gnattu opened this issue Mar 28, 2021 · 6 comments

Comments

@gnattu
Copy link

gnattu commented Mar 28, 2021

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

Previously, I could let RN to find node in non-standard location by specifying NODE_BINARY in Bundle React Native Code and images Build phase, but this stopped working after upgrade to RN 0.64 because generate-specs cannot find node.
Same setting was working well on RN 0.63.

React Native version:

System:
    OS: macOS 11.2.3
    CPU: (8) arm64 Apple M1
    Memory: 106.17 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 15.11.0 - /opt/homebrew/bin/node
    Yarn: 1.22.10 - ~/my_project/node_modules/.bin/yarn
    npm: 7.6.0 - /opt/homebrew/bin/npm
    Watchman: 4.9.0 - /opt/homebrew/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: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 15.0.2 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    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. Set export NODE_BINARY=/path/to/node in Bundle React Native Code and images in Xcode.
  2. Achieve the project, generate-specs will complain about node not found and build will fail.

Expected Results

The build should success as scripts should follow the NODE_BINARY setting.

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

PR #30781 stands out as it directly modifies how node is found in generate-specs.sh. Manually change NODE_BINARY in
generate-specs.sh to the path of node works around this problem, but it is dirty.

@ingjjaa2
Copy link

I tryed manually change NODE_BINARY in generate-specs.sh, but it did not work

@monholm
Copy link
Contributor

monholm commented Apr 13, 2021

We are seeing the same issue after upgrading to 0.64.0.

Always had source ~/.zshrc in build faces to allow for node to be found, but this is no longer enough.

As a temporary workaround, we are patching the generate-specs.sh as OP suggested, which mitigates the build failure.

@airtonix
Copy link

To be honest react-native shouldn't be doing anything with regards to imposing a node version manager on us...

it's because of these hacks I can't use Volta

@sakthiinfotec
Copy link

In XCode, Build Phases -> Bundle React Native code and images, just add

# Fix for machines using nvm
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
. "$HOME/.nvm/nvm.sh"
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
. "$(brew --prefix nvm)/nvm.sh"
fi

Above export NODE_BINARY=node

This will make Xcode work regardless of your machine using nvm.

@cortinico
Copy link
Contributor

Closing as this version of React Native is several years old. Please re-open a new issue against the latest stable if the issue persists

@aTreey
Copy link

aTreey commented Jan 29, 2024

solved
Because /usr/local/bin/node there is no node to obtain node in the path, you need to use the pkg installation package to install it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants