web-dev-qa-db-ja.com

Ruby on Rails互換性のないライブラリ

Ruby on Railsで、サーバーを実行できません。実行中ですRuby 2.3.0およびRails 4.2.5で、新しいRailプロジェクトを作成した後、_bin/Rails server_を実行しようとしましたが、次のエラーが発生します。

_Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
/Users/John/.rvm/gems/Ruby-head/gems/json-1.8.3/lib/json/ext.rb:13:in `require': incompatible library version - /Users/John/.rvm/gems/Ruby-head/gems/json-1.8.3/lib/json/ext/parser.bundle (fatal)
    from /Users/John/.rvm/gems/Ruby-head/gems/json-1.8.3/lib/json/ext.rb:13:in `<module:Ext>'
    from /Users/John/.rvm/gems/Ruby-head/gems/json-1.8.3/lib/json/ext.rb:12:in `<module:JSON>'
    from /Users/John/.rvm/gems/Ruby-head/gems/json-1.8.3/lib/json/ext.rb:9:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/json-1.8.3/lib/json.rb:58:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/json-1.8.3/lib/json.rb:58:in `<module:JSON>'
    from /Users/John/.rvm/gems/Ruby-head/gems/json-1.8.3/lib/json.rb:54:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/activesupport-4.2.5/lib/active_support/core_ext/object/json.rb:2:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/activesupport-4.2.5/lib/active_support/core_ext/object/json.rb:2:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/activesupport-4.2.5/lib/active_support/core_ext/object.rb:12:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/activesupport-4.2.5/lib/active_support/core_ext/object.rb:12:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/configuration.rb:2:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/configuration.rb:2:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/railtie.rb:2:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/railtie.rb:2:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/engine.rb:1:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/engine.rb:1:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/application.rb:7:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/application.rb:7:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails.rb:11:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails.rb:11:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/commands/server.rb:4:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/commands/server.rb:4:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/commands/commands_tasks.rb:123:in `require'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/commands/commands_tasks.rb:123:in `require_command!'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/commands/commands_tasks.rb:73:in `server'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/John/.rvm/gems/Ruby-head/gems/railties-4.2.5/lib/Rails/commands.rb:17:in `<top (required)>'
    from /Users/John/Developer/Rails/blog/bin/Rails:9:in `require'
    from /Users/John/Developer/Rails/blog/bin/Rails:9:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/spring-1.6.1/lib/spring/client/Rails.rb:28:in `load'
    from /Users/John/.rvm/gems/Ruby-head/gems/spring-1.6.1/lib/spring/client/Rails.rb:28:in `call'
    from /Users/John/.rvm/gems/Ruby-head/gems/spring-1.6.1/lib/spring/client/command.rb:7:in `call'
    from /Users/John/.rvm/gems/Ruby-head/gems/spring-1.6.1/lib/spring/client.rb:28:in `run'
    from /Users/John/.rvm/gems/Ruby-head/gems/spring-1.6.1/bin/spring:51:in `<top (required)>'
    from /Users/John/.rvm/gems/Ruby-head/gems/spring-1.6.1/lib/spring/binstub.rb:11:in `load'
    from /Users/John/.rvm/gems/Ruby-head/gems/spring-1.6.1/lib/spring/binstub.rb:11:in `<top (required)>'
    from /Users/John/.rvm/rubies/Ruby-head/lib/Ruby/site_Ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/John/.rvm/rubies/Ruby-head/lib/Ruby/site_Ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/John/Developer/Rails/blog/bin/spring:13:in `<top (required)>'
    from bin/Rails:3:in `load'
    from bin/Rails:3:in `<main>'
_

宝石リストには、私がjson (1.8.3, 1.8.2)を持っていると書かれています。また、Railsを再インストールし、rvmを介してRubyバージョンを更新してみました。何が問題なのかわかりませんか?オンラインで調べてみましたが、特に私はこれまでRailsを使用したことがなく、Rubyを少ししか使用していません。

9
John P

あなたのRuby環境で何かがおかしくなったり壊れたりしました。rvmのせいにします。個人的には、rvmのファンではありません。

ただし、gem uninstall jsonを試して、プロンプトに従ってすべてのバージョンをアンインストールすることもできます。その後、再びbundle install。その後、うまくいけば、あなたは修正されるでしょう。

14
jrochkind

別のRubyバージョンを使用した後(2.3.0-> 2.3.3から))、あなたが説明したのと同様の問題が発生しました。

私はそれが実行されていることを発見しました:

$ gem install bundler

次に:

$ bundle install

...私にとって魅力的でした。これにより、依存関係の問題なしに、Gemfileに必要なすべてのパッケージが再インストールされました。

1
Lance Fono

json gemの決してないバージョンがすでに存在し、Railsによってピックアップされているようです。バージョンを手動で削除することもできます。

gem uninstall json -v 1.8.2

または、すでにRVMを使用しているため、 create このプロジェクトに固有のgemsetです。

0
sqbell