Skip to content

Commit

Permalink
Source nvm.sh (best effort) when running react-native-xcode.sh
Browse files Browse the repository at this point in the history
Summary: When Node is installed with nvm, scripts invoked from Xcode need to set up nvm. This can be done either by sourcing .profile/.bash_profile/.bashrc/etc... or by sourcing nvm.sh directly -- this diff does the latter and handles the case where nvm may have been installed the official way (under ~/.nvm/nvm.sh AFAIK) or via homebrew.
Closes #4015

Reviewed By: svcscm

Differential Revision: D2633301

Pulled By: frantic

fb-gh-sync-id: 3c2b9b0d21887ba21d6f85f5d279314d50c1db28
  • Loading branch information
ide committed Nov 10, 2015
1 parent 46aa9c6 commit 6f48d9a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packager/react-native-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ cd ..
set -x
DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH

# Define NVM_DIR and source the nvm.sh setup script
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.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

react-native bundle \
--entry-file index.ios.js \
--platform ios \
Expand Down

0 comments on commit 6f48d9a

Please sign in to comment.