试图进入irb
,但突然开始收到此错误。尝试重新安装brew readline和重新链接,但是没有运气。有什么建议吗?
/Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/x86_64-darwin17/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)
Referenced from: /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/x86_64-darwin17/readline.bundle
Reason: image not found - /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/x86_64-darwin17/readline.bundle
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/irb/ext/save-history.rb:12:in `<top (required)>'
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/irb/extend-command.rb:243:in `save_history='
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/irb/context.rb:92:in `initialize'
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/irb.rb:412:in `new'
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/irb.rb:412:in `initialize'
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/irb.rb:383:in `new'
from /Users/asahmed/.rbenv/versions/2.4.2/lib/ruby/2.4.0/irb.rb:383:in `start'
from /Users/asahmed/.rbenv/versions/2.4.2/bin/irb:11:in `<main>'
答案 0 :(得分:2)
您可能已经升级了一些东西,以替换readline
库,现在有必要重建您的Ruby。当您运行brew clean
时,Homebrew很少会发生这种情况,并且它删除了过时的依赖版本,而没有意识到您的Ruby构建依赖于此。这是因为Rbenv无法与Homebrew通讯,它仍然需要该库。
这通常很容易解决。试试:
rbenv install 2.4.2
您可能还需要花一些时间更新到最新版本,即今天的2.5.3。