自制安装问题

自制安装问题

对 Linux 相当陌生,有一个关于安装 Homebrew 的问题。我正在使用 Centos7 并且已经更新了所有必需的依赖项(cURL 等)。当我从 Homebrew 主页运行 Linux 安装脚本时,该过程失败并出现以下错误:

==> /usr/bin/sudo /bin/chown -R username:username /home/linuxbrew/.linuxbrew/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (7/7), done.
remote: Total 16 (delta 7), reused 7 (delta 7), pack-reused 9
Unpacking objects: 100% (16/16), 3.98 KiB | 94.00 KiB/s, done.
From https://github.com/Homebrew/brew
   560f5717a..31758eaa0  master     -> origin/master
HEAD is now at 31758eaa0 Merge pull request #14027 from MikeMcQuaid/devcontainer
/home/linuxbrew/.linuxbrew/bin/brew: line 26: !": event not found
/home/linuxbrew/.linuxbrew/bin/brew: line 24: HOMEBREW_NO_ENV_FILTERING: unbound variable
Failed during: /home/linuxbrew/.linuxbrew/bin/brew update --force --quiet
[usernamek@centos ~]$ 

有人以前见过这个,或者可以为我指出正确的方向吗?在我的研究过程中,我在其他任何地方都找不到与此特定安装失败相关的任何信息。

根据评论,添加以下行/home/linuxbrew/.linuxbrew/bin/brew

#!/bin/bash    #line 1
#lines 21-28:
# Fail fast with concise message when requesting unfiltered environment.
# This is basically odisabled so can be removed at any major release afterwards
# and definitely if this is still here in 2023.
if [ -n "${HOMEBREW_NO_ENV_FILTERING}" ]
then
  echo "Error: HOMEBREW_NO_ENV_FILTERING was deprecated for over a year and has now been removed (because it breaks many things)!" >&2
  exit 1
fi

编辑:这是我从 Homebrew 主页运行的确切安装命令:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

谢谢!

答案1

我的新 MacBook Air 也遇到了类似的问题。由于互联网连接不稳定,我的安装被中断后发生了这种情况。我通过在终端中运行以下代码解决了该问题:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"   

稍后,它会询问您是否要删除 Homebrew 文件?输入“Y”并按 Enter 键。

之后打开取景器。

卸载 Homebrew 后,转到您的磁盘并删除终端中提到的 opt 文件夹中的 Homebrew 文件夹。注意:opt 是一个隐藏文件夹,按 command + shift + 后可以看到它。 (点)

删除 Homebrew 文件后重新安装 Homebrew :

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)".   

答案2

我有这个错误Error: HOMEBREW_NO_ENV_FILTERING was deprecated for over a year and has now been removed (because it breaks many things)!

我的解决方案是

从 shell 配置文件(如、或)中删除HOMEBREW_NO_ENV_FILTERING此变量。export.bash_profile.zshrc.bashrc

相关内容