Skip to content

Commit

Permalink
Add the npm global prefix to PATH.
Browse files Browse the repository at this point in the history
Summary:
Related to issue #4034 (comment).
The npm global install path may be set to a non-standard location. `react-native` is assumed to be in `PATH` but doesn't take into account the user's environment so building in Xcode fails:
~~~
react-native bundle --entry-file index.ios.js --platform ios --dev true --bundle-output [...]

../node_modules/react-native/packager/react-native-xcode.sh: line 48: react-native: command not found
Command /bin/sh failed with exit code 127
~~~
This fix uses `npm prefix -g` to get the bin location and adds it to `PATH`.
Closes #4749

Reviewed By: svcscm

Differential Revision: D2753215

Pulled By: androidtrunkagent

fb-gh-sync-id: 964d1a71ac1bf204545a594a9fa433a7bc367f35
  • Loading branch information
lamberta authored and facebook-github-bot-9 committed Dec 12, 2015
1 parent c60b581 commit d290723
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packager/react-native-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ cd ..
set -x
DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH

# npm global install path may be a non-standard location
PATH="$(npm prefix -g)/bin:$PATH"

# Define NVM_DIR and source the nvm.sh setup script
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"

Expand Down

0 comments on commit d290723

Please sign in to comment.