ruby-on-rails - rake 数据库 :setup is giving Library

我在 macOS 10.14.2 mojave 上,在我的 mysql 数据库上运行 rake db:setup 时出现错误。它在其他项目中工作正常,当我这样做时 gem list在其他项目中,他们都有 mysql 0.5.2 和 curb 0.9.7。我曾经遇到过相同的以下错误,除了它说的是 libssh2.1 而不是 libgssapi_krb5,所以我做了 brew install libssh2然后错误变成了这个。然后我尝试做 brew install krb5但这并没有什么不同。这是错误:

mbp-user:project user$ rake db:setup rake aborted! LoadError: dlopen(/Users/user/.rvm/gems/ruby-2.5.3/gems/curb-0.9.7/lib/curb_core.bundle, 9): Library not loaded: @rpath/libgssapi_krb5.2.2.dylib Referenced from: /Users/user/.rvm/gems/ruby-2.5.3/gems/curb-0.9.7/lib/curb_core.bundle Reason: image not found - /Users/user/.rvm/gems/ruby-2.5.3/gems/curb-0.9.7/lib/curb_core.bundle /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in require' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:inblock in require' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in load_dependency' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:inrequire' /Users/user/.rvm/gems/ruby-2.5.3/gems/curb-0.9.7/lib/curl.rb:1:in <top (required)>' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:inrequire' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in block in require' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:inload_dependency' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in require' /Users/user/.rvm/gems/ruby-2.5.3/gems/curb-0.9.7/lib/curb.rb:1:in' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in require' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:inblock in require' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in load_dependency' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:inrequire' /Users/user/.rvm/gems/ruby-2.5.3/gems/user_client-3.7.0/lib/user_client/helpers/http_client.rb:1:in <top (required)>' /Users/user/.rvm/gems/ruby-2.5.3/gems/user_client-3.7.0/lib/user_client/helpers/authorized_request.rb:1:inrequire_relative' /Users/user/.rvm/gems/ruby-2.5.3/gems/user_client-3.7.0/lib/user_client/helpers/authorized_request.rb:1:in <top (required)>' /Users/user/.rvm/gems/ruby-2.5.3/gems/user_client-3.7.0/lib/user_client/adapter.rb:2:inrequire_relative' /Users/user/.rvm/gems/ruby-2.5.3/gems/user_client-3.7.0/lib/user_client/adapter.rb:2:in <top (required)>' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:inrequire' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in block in require' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:inload_dependency' /Users/user/.rvm/gems/ruby-2.5.3/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in require' /Users/user/.rvm/gems/ruby-2.5.3/gems/user_client-3.7.0/lib/user_client.rb:2:in' /Users/user/work/angel/config/application.rb:7:in <top (required)>' /Users/user/work/angel/Rakefile:6:inrequire_relative' /Users/user/work/angel/Rakefile:6:in <top (required)>' /Users/user/.rvm/gems/ruby-2.5.3/gems/rake-12.3.1/exe/rake:27:in' /Users/user/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in eval' /Users/user/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in'

最佳答案

跟随错误时:

rake db:drop 

bundle exec rake db:drop

错误:

rake aborted!
LoadError: dlopen(/Users/afsan.abdulali.gujarati/.rvm/gems/ruby-2.4.6@introhive/gems/curb-0.9.10/lib/curb_core.bundle, 9): Library not loaded: @rpath/libgssapi_krb5.2.2.dylib
  Referenced from: /Users/afsan.abdulali.gujarati/.rvm/gems/ruby-2.4.6@introhive/gems/curb-0.9.10/lib/curb_core.bundle
  Reason: image not found - /Users/afsan.abdulali.gujarati/.rvm/gems/ruby-2.4.6@introhive/gems/curb-0.9.10/lib/curb_core.bundle
The thing that possibly fixed it:

解决方法:

brew install krb5

brew link --force krb5 

可能会给出以下输出:

Warning: Refusing to link macOS-provided software: krb5
If you need to have krb5 first in your PATH run:
  echo 'export PATH="/usr/local/opt/krb5/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/krb5/sbin:$PATH"' >> ~/.bash_profile

For compilers to find krb5 you may need to set:
  export LDFLAGS="-L/usr/local/opt/krb5/lib"
  export CPPFLAGS="-I/usr/local/opt/krb5/include"

For pkg-config to find krb5 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/krb5/lib/pkgconfig"

导出路径变量 LDFLAGS 和 CPPFLAGS

export LDFLAGS="-L/usr/local/opt/krb5/lib"
export CPPFLAGS="-I/usr/local/opt/krb5/include"

重新安装 curb gem

gem uninstall curb
gem install curb

关于我当前系统设置的附注:

Mac OS Catalina 10.15.3

我的系统上安装了 anaconda3,尽管我使用以下命令禁用了它:

conda 配置 --set auto_activate_base false

关于ruby-on-rails - rake 数据库 :setup is giving Library not loaded: @rpath/libgssapi_krb5. 2.2.dylib 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54444953/

相关文章:

Python:DataFrame.melt - 如何选择一系列列作为标识符变量?

sql - AWS Redshift 身份列插入 - 新记录的身份值不大于以前的最大身份值

python - 如何从 python 列表中删除转义字符 (\)?

amazon-ec2 - HAProxy - 基于 URL/路径路由到后端 IP?

python-3.x - celery 错误 : result. get(timeout=5) 超时

terminal - 转义码 VT102 和 ANSI

python - 如何在 Mac 上将 Python 完全恢复为出厂设置

javascript - 为什么 Chrome 在使用 Typed.js 时难以呈现表情符号?

python - 如何在 django 中使用 ajax 形式验证 django-recaptcha

azure-cosmosdb - 缓慢的 CosmosDB Mongodb 查询