昨晚我将 Ubuntu 从 18.04 更新到了 20.04。我是一名 Ruby on Rails 开发人员,自更新以来,我一直无法启动 Rails 控制台。
我收到与 libreadline.so.7 相关的错误。我尝试了一些方法,例如重新安装 Rails 或创建符号链接,但都没有用。我还尝试从控制台获取包,但它说没有可供下载的候选包。
find /usr/lib -name "libffi.so*"
/usr/lib/x86_64-linux-gnu/libffi.so.7
/usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
/usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
/usr/lib/x86_64-linux-gnu/libffi.so
/usr/lib/x86_64-linux-gnu/libffi.so.6
rails c
Traceback (most recent call last):
14: from ./bin/rails:4:in `<main>'
13: from ./bin/rails:4:in `require'
12: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/commands.rb:18:in `<top (required)>'
11: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command.rb:44:in `invoke'
10: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command.rb:70:in `find_by_namespace'
9: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command/behavior.rb:39:in `lookup'
8: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command/behavior.rb:39:in `each'
7: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command/behavior.rb:40:in `block in lookup'
6: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command/behavior.rb:40:in `each'
5: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command/behavior.rb:44:in `block (2 levels) in lookup'
4: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/command/behavior.rb:44:in `require'
3: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/commands/console/console_command.rb:4:in `<top (required)>'
2: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.3.4/lib/rails/commands/console/console_command.rb:4:in `require'
1: from /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/2.6.0/irb/completion.rb:10:in `<top (required)>'
/home/elianvm/.rbenv/versions/2.6.3/lib/ruby/2.6.0/irb/completion.rb:10:in `require': libreadline.so.7: cannot open shared object file: No such file or directory - /home/elianvm/.rbenv/versions/2.6.3/lib/ruby/2.6.0/x86_64-linux/readline.so (LoadError)
我不太明白发生了什么,所以我不知道还能尝试什么。如能得到任何帮助我将不胜感激。
答案1
检查你的Gemfile.lock
。它将列出 rails 应用程序正在寻找的所有内容的版本。它可能有版本0.7
。从 中Gemfile.lock
,您可以查找正在使用的 gemlibreadline
并查找实现较新版本的版本。在您的 中Gemfile
,指定适当的版本,您就可以开始了。