从ubuntu 16.04升级到ubuntu 18.04后,我从rails项目的根目录运行rails console
时收到以下错误。只有控制台似乎受到影响,我能够毫无问题地启动puma服务器。
Running via Spring preloader in process 23887
/home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require': libreadline.so.6: cannot open shared object file: No such file or directory - /home/user/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/x86_64-linux/readline.so (LoadError)
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /home/user/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/irb/completion.rb:10:in `<top (required)>'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /home/user/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/commands/console/console_command.rb:2:in `<top (required)>'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /home/user/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/command/behavior.rb:82:in `block (2 levels) in lookup'
from /home/user/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/command/behavior.rb:78:in `each'
from /home/user/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/command/behavior.rb:78:in `block in lookup'
from /home/user/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/command/behavior.rb:77:in `each'
from /home/user/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/command/behavior.rb:77:in `lookup'
from /home/user/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/command.rb:68:in `find_by_namespace'
from /home/user/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/command.rb:42:in `invoke'
from /home/user/.rvm/gems/ruby-2.4.1/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
from /home/user/dev/projects/SRTrackerMySQL/bin/rails:9:in `<top (required)>'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `block in load'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
from /home/user/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
from /home/user/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /home/user/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from -e:1:in `<main>'
我已经bundle install
运行并尝试使用Rails 5.1.6
和Rails 5.2
的新导轨项目
我也尝试过RAILS_ENV=production bundle exec rails console
我使用的是Ruby版本:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
答案 0 :(得分:9)
您需要确保已安装readline。您正在使用RVM,因此您可以运行:
rvm requirements
它应该有助于确保您安装了所需的一切,然后是:
rvm reinstall 2.4.1
如果需要确保你的红宝石好。
答案 1 :(得分:6)
我也有同样的问题,但是我们使用rbenv
而不是rvm
。对于Brian为我工作的类似答案:
rbenv uninstall 2.4.1
rbenv install 2.4.1
答案 2 :(得分:1)
重新安装Ruby和重新哈希rbenv对我不起作用。最后,我使用了当前安装的<prism:InteractionRequestTrigger SourceObject="{Binding InteractionRequest}">
<prism:PopupWindowAction WindowStyle="{StaticResource WindowStyle}">
<prism:PopupWindowAction.WindowContent>
<sharedV:InformationDialog />
</prism:PopupWindowAction.WindowContent>
</prism:PopupWindowAction>
</prism:InteractionRequestTrigger>
libreadline.so7
这返回了完整的可能选项列表,但是最可能使用的选项似乎是locate libreadline.so
/lib/x86_64-linux-gnu/libreadline.so.7
链接后,我现在可以运行sudo ln -s /lib/x86_64-linux-gnu/libreadline.so.7 /lib/x86_64-linux-gnu/libreadline.so.6
并再次使用rails console
。
答案 3 :(得分:1)
在终端上运行以下代码为我解决了这个问题:
cd /lib/x86_64-linux-gnu
sudo ln -s libreadline.so.7.0 libreadline.so.6
答案 4 :(得分:0)
在将Ubuntu从16.04升级到18.04之后,我也无法运行rails console
。我得到了类似的东西:
-bash: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory
我不得不按照此处发布的说明重新安装rvm: https://github.com/rvm/ubuntu_rvm
答案 5 :(得分:0)
升级后我遇到了同样的问题。我的猜测是RVM会发生问题。
因此,首先卸载RVM。
rvm implode
然后,执行以下命令以再次安装RVM
sudo apt install gnupg2
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
cd /tmp
curl -sSL https://get.rvm.io -o rvm.sh
less /tmp/rvm.sh
cat /tmp/rvm.sh | bash -s stable --rails
source /home/admat/.rvm/scripts/rvm
重新加载RVM
rvm reload
安装您的ruby版本
rvm install _version_
使用bundle命令安装gems
bundle install
完成!!!!!
如果您想了解将Ruby安装到ubuntu 18.04的更多详细信息,请尝试以下链接 Install ruby on rails with Ubuntu 18.04