Brew报错:Version value must be a string; got a NilClass () (TypeError)
今天使用brew更新软件时,大概是因为太长时间没有更新了,出现了以下错误信息:
Updating Homebrew...
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只支持正式发行版。/usr/local/Homebrew/Library/Homebrew/version.rb文件中第368行直接用@version = '10.14.1'给定一个版本号就可以了。但是我修改了以后,没有用。因为每次启动brew命令后/usr/local/Homebrew/Library/Homebrew/version.rb文件就会回复为原来的样子,错误依旧。
没有办法,那么就重置吧:brew update-reset。然后就OK了。
————————————————
版权声明:本文为CSDN博主「mouse2018」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/mouse2018/article/details/114324847