web-dev-qa-db-ja.com

rails cが機能しないRails 5

Rails 5アプリケーション内のターミナルでコマンドを使用する場合

Rails c

スローされたエラーは次のとおりです。ここでの同様の質問で、これが何を意味するのかわかりません。解決策はスプリングストップを使用することでした。私もそれを試しましたが、それでも同じエラーは発生しませんでした。誰かがここで間違いを指摘できれば素晴らしいと思います。

Running via Spring preloader in process 6457
/Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': dlopen(/Users/AmanChawla/.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/AmanChawla/.rvm/rubies/Ruby-2.3.0/lib/Ruby/2.3.0/x86_64-darwin15/readline.bundle
  Reason: image not found - /Users/AmanChawla/.rvm/rubies/Ruby-2.3.0/lib/Ruby/2.3.0/x86_64-darwin15/readline.bundle
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/AmanChawla/.rvm/rubies/Ruby-2.3.0/lib/Ruby/2.3.0/irb/completion.rb:10:in `<top (required)>'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/railties-5.0.0.1/lib/Rails/commands/console.rb:3:in `<top (required)>'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/railties-5.0.0.1/lib/Rails/commands/commands_tasks.rb:138:in `require_command!'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/railties-5.0.0.1/lib/Rails/commands/commands_tasks.rb:68:in `console'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/railties-5.0.0.1/lib/Rails/commands/commands_tasks.rb:49:in `run_command!'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/railties-5.0.0.1/lib/Rails/commands.rb:18:in `<top (required)>'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
    from /Users/AmanChawla/Desktop/NewApp/bin/Rails:9:in `<top (required)>'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `block in load'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
    from /Users/AmanChawla/.rvm/gems/Ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:287:in `load'
    from /Users/AmanChawla/.rvm/rubies/Ruby-2.3.0/lib/Ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/AmanChawla/.rvm/rubies/Ruby-2.3.0/lib/Ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'
15
Aman Chawla

最近、HomeBrewを更新したときにこの問題が発生しました。また、Rails 5で作業していて、この解決策を見つけました。これでうまくいきました。

ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib

ソース: https://Gist.github.com/mcshakes/c87e8adda174c73be354094800b9756d

[〜#〜]更新[〜#〜]

Readline 8以降のバージョンについては、@ CodyElhardの回答に従ってください。

36
Moyom

自作でreadlineを更新したためにこのエラーが発生した場合の一般的なアプローチとして

新しいバージョンは、_brew install readline_の出力を読み取ることで見つけることができます

私の出力:_readline 8.0.0 is already installed and up-to-date_

古いバージョンはロードエラーで見つかります

私のエラー(7に注意):Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)

_ln -s new_version/path/to/readline original_version/path/to/readline
_

私の場合、私の命令は

_ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
_
21
Cody Elhard

このgemを追加するだけでこの問題を修正しましたgem 'rb-readline'および実行中のバンドル。

rb-readline

9
zee

これは、この問題の標準的な修正です。これを試してください。

brew rm -f readline

brew install readline

brew link readline --force

ここに参照リンクがあります libreadlineのためにRailsコンソールがロードされません

2
Shawn Wilson

もう1つの問題は、どのバージョンのRubyがパスにあるかです。それも再確認してください。

Ruby -v
ls -la `which Ruby`

次に、パスを確認します

0
Rob Fuller