brew服务启动mongodb-community@4.2错误:未知命令:服务

brew服务启动mongodb-community@4.2错误:未知命令:服务,mongodb,homebrew,macos-catalina,Mongodb,Homebrew,Macos Catalina,我试图通过运行brew服务启动MongoDB来运行MongoDB-community@4.2但我得到了您在下面看到的错误: jaimes-mbp:SMR jaimemontoya$ brew services start mongodb-community@4.2 ==> Tapping homebrew/services Cloning into '/usr/local/Library/Taps/homebrew/homebrew-services'... remote: Enumera

我试图通过运行
brew服务启动MongoDB来运行MongoDB-community@4.2
但我得到了您在下面看到的错误:

jaimes-mbp:SMR jaimemontoya$ brew services start mongodb-community@4.2
==> Tapping homebrew/services
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 27 (delta 0), reused 16 (delta 0), pack-reused 0
Unpacking objects: 100% (27/27), done.
Checking connectivity... done.
Tapped 0 formulae (63 files, 276K)
Error: Unknown command: services
jaimes-mbp:SMR jaimemontoya$ 
brew
不是命令吗,
services
只是一个参数吗?我不明白为什么错误会说
services
是未知命令。多谢各位

更新1:我在尝试运行
brew安装mongodb时看到两条警告-community@4.2
请再说一遍。也许这和问题有关

jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community@4.2
Warning: mongodb/brew/mongodb-community-4.2.3 already installed
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
更新2:当我使用
mongo
时,它正在做一些事情:

jaimes-mbp:SMR jaimemontoya$ mongo
MongoDB shell version v4.2.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-03-13T06:41:22.073-0600 E  QUERY    [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-03-13T06:41:22.076-0600 F  -        [main] exception: connect failed
2020-03-13T06:41:22.076-0600 E  -        [main] exiting with code 1
jaimes-mbp:SMR jaimemontoya$  
也许我不需要使用
brew服务启动mongodb-community@4.2
?我认为有必要运行MongoDB社区版

更新3:我运行
ps aux | grep-v grep | grep mongod
时,它不返回任何内容。我试图验证MongoDB是否正在运行,因此我在运行的进程中搜索
mongod
,但它没有返回任何内容,这意味着我猜MongoDB没有运行

更新4:查看运行
brew医生--verbose时发生的情况:

Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.

Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.

Warning: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
您可能应该更改/usr/local的所有权和权限 返回到您的用户帐户。 sudo chown-R$(whoami):admin/usr/local

当我运行
sudo chown-R$(whoami):admin/usr/local
时,我得到以下结果:

jaimes-mbp:SMR jaimemontoya$ sudo chown -R $(whoami):admin /usr/local
Password:
chown: /usr/local: Operation not permitted
jaimes-mbp:SMR jaimemontoya$ 
brew更新
不工作:

jaimes-mbp:SMR jaimemontoya$ brew update
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.

You should probably change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami):admin /usr/local
jaimes-mbp:SMR jaimemontoya$ 

似乎您正面临
brew
的问题

运行
brew医生--verbose
,检查brew是否工作正常

然后
brew update
更新brew版本

运行此操作后,
brew服务列表
,以显示brew中的所有服务

如果你看到mongodb-community@4.2在列表中,然后运行
brew服务启动mongodb-community@4.2


它应该会起作用。

我遵循了MikeMcQuaid在以下网站上提供的建议:

您需要使用卸载和安装Homebrew

正如在中所解释的,我首先运行了
/usr/bin/ruby-e“$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/uninstall)“
。之后,我运行了
/bin/bash-c“$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install.sh)“

然后我运行这个:

jaimes mbp:SMR JAIMOMONTOYA$brew tap mongodb/brew
正在更新自制。。。
==>自动更新的自制软件!
更新了1个tap(自制/核心)。
公式没有变化。
==>点击mongodb/brew
克隆到“/usr/local/Homebrew/Library/Taps/mongodb/Homebrew”。。。
远程:枚举对象:86,完成。
远程:计数对象:100%(86/86),完成。
远程:压缩对象:100%(76/76),完成。
远程:共145个(增量41),重复使用21个(增量10),包重复使用59个
接收对象:100%(145/145),30.18kib | 2.16mib/s,完成。
解析三角洲:100%(68/68),完成。
攻丝6个公式(33个文件,83.0KB)。
jaimes mbp:SMR JAIMOMONTOYA$brew安装mongodb-community@4.2
==>从mongodb/brew安装mongodb社区
==>下载https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.3.tgz
######################################################################## 100.0%
==>注意事项
要立即启动mongodb/brew/mongodb社区并在登录时重新启动,请执行以下操作:
brew服务启动mongodb/brew/mongodb社区
或者,如果您不想要/不需要后台服务,您可以运行:
mongod--config/usr/local/etc/mongod.conf
==>摘要

这能解决您的问题吗?请参阅我的更新4。显然,使用OSX10.15是一个问题,这很奇怪,因为它是OSX的最新版本,我升级了,因为我认为旧版本是问题所在。我的
/usr/local
目录不可写这一事实似乎也是一个问题。