ruby-on-rails – 无法执行Rails控制台命令Ruby

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 无法执行Rails控制台命令Ruby前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `require': dlopen(/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle,9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
  Referenced from: /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
  Reason: image not found - /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
    from /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `<top (required)>'
    from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:3:in `require'
    from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:3:in `<top (required)>'
    from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:138:in `require'
    from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:138:in `require_command!'
    from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
    from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

尝试执行命令后,这是我的错误屏幕.我试图卸载并重新安装readline,但没有帮助.我只是学习rails并且不会100%知道我在做什么(只是按照指南)所以这种类型的错误超出了我的理解.谢谢!

解决方法

可能不相关,但我今天也遇到了同样的事情.

今天早上我有一个功能齐全的Ruby 2.3.1工作正常.就我而言,Ruby是由ruby-build编译和安装的,由rbenv管理.

今天有一次我更新了Homebrew

brew cleanup --prune=30
brew update
brew upgrade

其中一个升级的公式是readline 7.0:

$brew info readline
...
/usr/local/Cellar/readline/7.0 (45 files,2M)
  Poured from bottle on 2016-10-05 at 08:09:22

不久之后我发现我对Ruby的readline支持已经彻底破解了.我看到的错误和你的一样:

/Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pry-0.10.4/lib/pry/config/default.rb:151:in `require': dlopen(/Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle,9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)
  Referenced from: /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
  Reason: image not found - /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle
  from /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pry-0.10.4/lib/pry/config/default.rb:151:in `lazy_readline'

解决方案是完全删除我的Ruby安装并重新编译它:

rm -rf ~/.rbenv/versions/2.3.1
rbenv install 2.3.1

我知道你使用的是rvm而不是rbenv,但也许你的情况下的解决方案是类似的:删除你的Ruby安装并使用rvm重新安装它.

原文链接:https://www.f2er.com/ruby/269424.html

猜你在找的Ruby相关文章