Skip to content

Instantly share code, notes, and snippets.

@joeyfigaro
Last active June 24, 2025 15:19
Show Gist options
  • Save joeyfigaro/245ce9c5bf7b34fadf5406e960f146e5 to your computer and use it in GitHub Desktop.
Save joeyfigaro/245ce9c5bf7b34fadf5406e960f146e5 to your computer and use it in GitHub Desktop.
ensure `NODE_BINARY` exists during Xcode build time
# From discussion in schniz/fnm
# https://github.com/Schniz/fnm/issues/475#issuecomment-2672700307
# original author @erkie (https://github.com/erkie)
# No node? Try to load via fnm
if ! command -v node &> /dev/null; then
output=$(zsh -l -c 'source ~/.profile; source ~/.zshrc; eval "$(fnm env --shell=zsh)" && fnm env')
eval "$output"
# if no node is found throw an error
if ! command -v node &> /dev/null; then
echo "Node could not be found: $SHELL $USER $HOME"
exit 1
fi
fi
export NODE_BINARY="$(realpath $(which node))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment