Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/react-native/scripts/cocoapods/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,21 @@ def self.create_xcode_env_if_missing(file_manager: File)
end

if !file_manager.exist?("#{file_path}.local")
node_binary = `command -v node`
# When installing pods with a yarn alias, yarn creates a fake yarn and node executables
# in a temporary folder.
# Using `type -a` we are able to retrieve all the paths of an executable and we can
# exclude the temporary ones.
# see https://github.com/facebook/react-native/issues/43285 for more info
node_binary = `type -a node`.split("\n").map { |path|
path.gsub!("node is ", "")
}

if (!node_binary[0].start_with?("/var"))
node_binary = node_binary[0]
else
node_binary = node_binary[1]
end

system("echo 'export NODE_BINARY=#{node_binary}' > #{file_path}.local")
end
end
Expand Down