尝试在 macOS 上安装 MongoDB 时“未找到类似名称的公式”

Ayo*_*b k 10 macos homebrew mongodb

我正在尝试使用brew 在 macOS Big Sur 上安装 MongoDB 服务器,我正在关注 mongo 官方网站上的文档。
我运行以下命令:

brew tap mongodb/brew
Run Code Online (Sandbox Code Playgroud)

之后,我运行:

brew install mongodb-community@4.4
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

错误:未找到类似名称的公式。
错误:没有名称为“mongosh”的可用公式(mongodb/brew/mongodb-community 的依赖项)。
它已从 mongodb/brew 迁移到 homebrew/core。

see*_*f07 5

对我来说homebrew-core没有正确点击。

 brew doctor


Warning: Homebrew/homebrew-core was not tapped properly! Run:
  rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"
  brew tap homebrew/core

Warning: Some taps are not on the default git origin branch and may not receive
updates. If this is a surprise to you, check out the default branch with:
  git -C $(brew --repo homebrew/core) checkout master
Run Code Online (Sandbox Code Playgroud)

我们需要再次删除并点击自制程序/核心。

rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"
brew tap homebrew/core
Run Code Online (Sandbox Code Playgroud)

之后我们需要点击 mongodb/brew

brew tap mongodb/brew
Run Code Online (Sandbox Code Playgroud)

然后安装mongodb-community

brew install mongodb-community
Run Code Online (Sandbox Code Playgroud)

这对我有用。


p4b*_*och 0

您需要通过运行来删除水龙头brew untap mongodb/brew

然后您可以运行brew install mongodb-community@4.4,它将从核心自制程序水龙头安装,即软件包现在所在的位置。