我一直收到错误:安装PHP时“Git必须安装在PATH中”

watbbzwu  于 2023-04-04  发布在  Git
关注(0)|答案(2)|浏览(171)

我尝试在运行Monterey的Mac上安装php。我尝试使用brew安装它,得到以下错误:错误:Git必须安装在您的PATH中!
我试过brew医生和brew升级,他们给予同样的错误。任何帮助将是伟大的。
下面是完整的代码:

andrews-mbp:OSX-Messages-Exporter-master andrew$ brew install php@7.4
/usr/local/Homebrew/Library/Homebrew/version.rb:366:in `initialize': Version value must be a string; got a NilClass () (TypeError)
    from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:23:in `initialize'
    from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `new'
    from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `version'
    from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:52:in `prerelease?'
    from /usr/local/Homebrew/Library/Homebrew/os.rb:19:in `<module:OS>'
    from /usr/local/Homebrew/Library/Homebrew/os.rb:1:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/Homebrew/Library/Homebrew/global.rb:26: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>'
Error: Git must be installed and in your PATH!
/usr/local/Homebrew/Library/Homebrew/version.rb:366:in `initialize': Version value must be a string; got a NilClass () (TypeError)
    from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:23:in `initialize'
    from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `new'
    from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:18:in `version'
    from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:52:in `prerelease?'
    from /usr/local/Homebrew/Library/Homebrew/os.rb:19:in `<module:OS>'
    from /usr/local/Homebrew/Library/Homebrew/os.rb:1:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/Homebrew/Library/Homebrew/global.rb:26: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>'
andrews-mbp:OSX-Messages-Exporter-master andrew$
bzzcjhmw

bzzcjhmw1#

您可能缺少xcode-select工具。请尝试以下命令。

xcode-select --install
h7appiyu

h7appiyu2#

似乎与rosetta unable to knit pdf on M2 Mac: pandoc error Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc: Bad CPU type in executable有关
我确实运行了/usr/sbin/softwareupdate --install-rosetta --agree-to-license,事情得到了解决。

相关问题