当前位置: 代码迷 >> 综合 >> /usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize‘: Version value must be a string;
  详细解决方案

/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize‘: Version value must be a string;

热度:104   发布时间:2023-11-25 00:28:58.0
~ brew install scrcpy

之前Mac更新过一次系统,现在用brew下载scrcpy的时候报错如下:

Traceback (most recent call last):11: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'9: from /usr/local/Homebrew/Library/Homebrew/global.rb:29:in `<top (required)>'8: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'7: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'6: from /usr/local/Homebrew/Library/Homebrew/os.rb:3:in `<top (required)>'5: from /usr/local/Homebrew/Library/Homebrew/os.rb:21:in `<module:OS>'4: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:58:in `prerelease?'3: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `version'2: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `new'1: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:26:in `initialize'
/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)

问题就在brew的版本上面,解决方法:

~ brew update-reset

之后即可恢复正常使用:

  相关解决方案