我刚刚跳入iTerm2安装纱线,并做了正常的,这是一个brew update
,然后是一个brew install
,并收到了一个错误…所以我尝试了brew doctor
,得到了同样的错误…下面是输出:
~ $brew update
Already up-to-date.
michael on Mikes-MacBook-Pro (c for commands)
~ $brew install yarn
/usr/local/Homebrew/Library/Homebrew/standalone/load_path.rb:12:in `require_relative': /usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/setup.rb:99: syntax error, unexpected <<, expecting end-of-input (SyntaxError)
<<<<<<< HEAD
^~
from /usr/local/Homebrew/Library/Homebrew/standalone/load_path.rb:12:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/startup.rb:6:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/startup.rb:6:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/global.rb:4:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/global.rb:4:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `<main>'
michael on Mikes-MacBook-Pro (c for commands)
~ $brew doctor
/usr/local/Homebrew/Library/Homebrew/standalone/load_path.rb:12:in `require_relative': /usr/local/Homebrew/Library/Homebrew/vendor/bundle/bundler/setup.rb:99: syntax error, unexpected <<, expecting end-of-input (SyntaxError)
<<<<<<< HEAD
^~
from /usr/local/Homebrew/Library/Homebrew/standalone/load_path.rb:12:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/startup.rb:6:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/startup.rb:6:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/global.rb:4:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/global.rb:4:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `<main>'
michael on Mikes-MacBook-Pro (c for commands)
~ $
下面是load_path的内容。rb……我看到了"require_relative"但是我不知道它有什么问题,因为我不理解它的引用上下文…
# typed: true
# frozen_string_literal: true
require "pathname"
HOMEBREW_LIBRARY_PATH = Pathname(__dir__).parent.realpath.freeze
require_relative "../utils/gems"
Homebrew.setup_gem_environment!(setup_path: false)
$LOAD_PATH.push HOMEBREW_LIBRARY_PATH.to_s unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s)
require_relative "../vendor/bundle/bundler/setup"
$LOAD_PATH.uniq!
# Block any gem loading by bypassing rubygem's `require`.
# Helps make sure we don't accidentally use things not in bundler's load path.
# Bundler 2.2.7+ and non-standalone mode both do this automatically.
# https://github.com/rubygems/rubygems/blob/5841761974bef324a33ef1cb650bbf8a2457805b/bundler/lib/bundler/installer/standalone.rb#L55-L63
if Kernel.private_method_defined?(:gem_original_require)
Kernel.send(:remove_method, :require)
Kernel.send(:define_method, :require, Kernel.instance_method(:gem_original_require))
Kernel.send(:private, :require)
end
我在谷歌上搜索如何重新安装Homebrew,但没有一个问题的答案看起来远邀请…有没有人知道我在这里看到了什么谁可以提供一些有见地的选择,我可以尝试一下?
谢谢你,迈克
解决方案是完全删除Homebrew并重新安装它以及我以前在Homebrew中安装的所有程序。
sudo rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"