【问题标题】:brew services start mongodb-community@4.0 fails - uninitialized constantbrew services start mongodb-community@4.0 失败 - 未初始化的常量
【发布时间】:2019-05-05 03:51:20
【问题描述】:

我已按照MongoDB docs 上的说明使用自制软件在 Mac 上安装 MongoDB:

brew tap mongodb/brew
brew install mongodb-community@4.0

然后我可以在前台运行它:

mongod --config /usr/local/etc/mongod.conf

但是,当尝试将其作为服务启动时:

brew services start mongodb-community@4.0

我收到此错误:

Error: mongodb-community: uninitialized constant #<Class:0x00007ff189061008>::Gem

我在运行brew doctor时也遇到这个错误:

Warning: Some installed formulae are not readable:
  mongodb-community: uninitialized constant #<Class:0x00007ffd903152a0>::Gem

为什么会这样?我该如何解决?

谢谢!

【问题讨论】:

  • 能否请您检查它是否运行良好而不作为mac os服务运行打开终端并运行命令mongod
  • 刚刚更新了问题。是的,我可以在前台运行它。
  • 您的 MacOS 的具体版本是什么? (从终端检查的一种方法是sw_vers -productVersion
  • MacOS 版本:10.14.4
  • 有人找到解决方案了吗?我也遇到了同样的问题,现在拉头发好几个小时了。

标签: mongodb homebrew


【解决方案1】:

这是 mongodb-community 公式的错误。 An issue has been filed 与维护人员、a solution founda pull request with the fix 已打开。

与此同时,您可以自己修复错误。公式中的This line 抛出异常:

Gem::Version.new(v['version'])

因为尚未导入 Gem 类。添加导入:

require 'rubygems'

解决问题。您可以在本地执行此操作,方法是在计算机上查找和编辑公式。它可能在这个文件中:

/usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew/Formula/mongodb-community.rb

更新:社区贡献者已在上游修复了此问题。如果您仍然遇到此问题,您可能需要运行 brew update

【讨论】:

  • 很好的研究,谢谢(:
【解决方案2】:

我知道这不是正确的答案,因为我们正在讨论使用以下方式注册服务:

brew services start mongodb-community

但我通过这种方式解决了服务注册问题:

sudo cp /usr/local/Cellar/mongodb-community/4.0.9/homebrew.mxcl.mongodb-community.plist /Library/LaunchAgents/

launchctl load -w /Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

launchctl start mongodb-community

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-09-22
    • 1970-01-01
    • 2016-09-19
    • 2015-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多