Skip to content

Commit 6334ac3

Browse files
redreceiptfacebook-github-bot
authored andcommitted
Fixes Global Node Prefix Error (#31740)
Summary: Some users have `node` installed globally which sets a `PREFIX` by default (so it knows where to put pkgs). We are looking for the "right" node on the next step anyway and if the user is using `nvm`, `PREFIX` breaks it. closes #31181 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [General] [Fixed] - Ignores global npm prefix Pull Request resolved: #31740 Test Plan: `yarn ios` now works, even if there's a `usr/local/bin/npm` <img width="493" alt="Screen Shot 2021-06-17 at 10 14 08 AM" src="https://user-images.githubusercontent.com/2659478/122413946-c2f57200-cf54-11eb-817c-bd3c07ac50bf.png"> Reviewed By: yungsters Differential Revision: D31237363 Pulled By: charlesbdudley fbshipit-source-id: 4ee9c04f8b8ab4e815bafbe2d02e589d621577b4
1 parent 5c12a84 commit 6334ac3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

scripts/find-node.sh

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
set -e
88

9+
# remove global prefix if it's already set
10+
# the running shell process will choose a node binary and a global package directory breaks version managers
11+
unset PREFIX
12+
913
# Support Homebrew on M1
1014
HOMEBREW_M1_BIN=/opt/homebrew/bin
1115
if [[ -d $HOMEBREW_M1_BIN && ! $PATH =~ $HOMEBREW_M1_BIN ]]; then

0 commit comments

Comments
 (0)