Skip to content

Commit ab09248

Browse files
lambertafacebook-github-bot-9
authored and
facebook-github-bot-9
committed
Add the npm global prefix to PATH.
Summary: Related to issue facebook/react-native#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 facebook/react-native#4749 Reviewed By: svcscm Differential Revision: D2753215 Pulled By: androidtrunkagent fb-gh-sync-id: 964d1a71ac1bf204545a594a9fa433a7bc367f35
1 parent 2927b76 commit ab09248

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

react-native-xcode.sh

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ cd ..
2929
set -x
3030
DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
3131

32+
# npm global install path may be a non-standard location
33+
PATH="$(npm prefix -g)/bin:$PATH"
34+
3235
# Define NVM_DIR and source the nvm.sh setup script
3336
[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
3437

0 commit comments

Comments
 (0)