Mac Homebrew命令报错/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize’

Posted 卡卡西Sensei

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac Homebrew命令报错/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize’相关的知识,希望对你有一定的参考价值。

 

目录

 

1.Homebrew命令报错

2.问题分析

3.解决方法


1.Homebrew命令报错

安装 nasm的时候突然报错了,报错信息如下

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:37:in `<top (required)>'

8: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

7: from /Library/Ruby/Site/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)

所有的命令,好像都失效了

2.问题分析

造成这个 Homebrew 失效的原因可能是 Mac 在升级成 Big Sur 系统后(我的是 macOS Big Sui Version 11.4),旧版本的 Homebrew 不适配了

3.解决方法

网上查了下最新版的 Homebrew 已经解决了这个错误,所以 Homebrew 更新到最新的版本就可以了

更新指令

brew update-reset
brew update-reset

Homebrew更新完成之后,我们再再执行 brew -v 看看

完美执行了,说明现在Homebrew是正常的了,可以正常使用了

 

🌹欢迎大家留言交流,批评指正,互相学习😁,提升自我🌹

 

 

 

以上是关于Mac Homebrew命令报错/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize’的主要内容,如果未能解决你的问题,请参考以下文章

M1 Mac安装Homebrew报错

Mac安装Redis:报错Running Homebrew as root is extremely dangerous and no longer supported.

Brew:Mac OS 使用brew命令报错“Error opening archive: Failed to open ‘../Caches/Homebrew../”解决方法

Brew:Mac OS 使用brew命令报错“Error opening archive: Failed to open ‘../Caches/Homebrew../”解决方法

Brew:Mac OS 使用brew命令报错“Error opening archive: Failed to open ‘../Caches/Homebrew../”解决方法

Mac 执行 gulp 报错 -bash: gulp: command not found