我已遵循MongoDB文档上的指示,使用自制软件在Mac上安装MongoDB:
brew tap mongodb/brew
brew install mongodb-community@4.0
Run Code Online (Sandbox Code Playgroud)
然后,我可以使用以下命令在前台运行它:
mongod --config /usr/local/etc/mongod.conf
Run Code Online (Sandbox Code Playgroud)
但是,当尝试使用以下命令将其作为服务启动时:
brew services start mongodb-community@4.0
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Error: mongodb-community: uninitialized constant #<Class:0x00007ff189061008>::Gem
Run Code Online (Sandbox Code Playgroud)
运行时我也收到此错误brew doctor:
Warning: Some installed formulae are not readable:
mongodb-community: uninitialized constant #<Class:0x00007ffd903152a0>::Gem
Run Code Online (Sandbox Code Playgroud)
为什么会这样呢?我如何解决它?
谢谢!
这是mongodb-community公式的错误。维护人员已提出问题,找到了解决方案,并且在打开了修复程序的情况下提出了请求。
同时,您可以自己修复错误。公式中的这一行引发异常:
Gem::Version.new(v['version'])
Run Code Online (Sandbox Code Playgroud)
因为尚未导入Gem类。添加导入:
require 'rubygems'
Run Code Online (Sandbox Code Playgroud)
解决了问题。您可以通过在计算机上查找和编辑公式来本地执行此操作。它可能在此文件中:
/usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew/Formula/mongodb-community.rb
Run Code Online (Sandbox Code Playgroud)
更新:社区贡献者已在上游修复此问题。如果仍然遇到此问题,则可能需要运行brew更新
| 归档时间: |
|
| 查看次数: |
1288 次 |
| 最近记录: |