当前位置:  开发笔记 > 后端 > 正文

Ruby on Rails不兼容的库

如何解决《RubyonRails不兼容的库》经验,为你挑选了1个好方法。

我刚开始看看rails上的ruby并且无法运行服务器.我正在运行ruby 2.3.0和rails 4.2.5并且在我有一个新的铁路项目之后我尝试运行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 `'
    from /Users/John/.rvm/gems/ruby-head/gems/json-1.8.3/lib/json/ext.rb:12:in `'
    from /Users/John/.rvm/gems/ruby-head/gems/json-1.8.3/lib/json/ext.rb:9:in `'
    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 `'
    from /Users/John/.rvm/gems/ruby-head/gems/json-1.8.3/lib/json.rb:54:in `'
    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 `'
    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 `'
    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 `'
    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 `'
    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 `'
    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 `'
    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 `'
    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 `'
    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 `'
    from /Users/John/Developer/Rails/blog/bin/rails:9:in `require'
    from /Users/John/Developer/Rails/blog/bin/rails:9:in `'
    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 `'
    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 `'
    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 `'
    from bin/rails:3:in `load'
    from bin/rails:3:in `
'

宝石清单说我有json (1.8.3, 1.8.2).我也尝试重新安装rails并通过rvm更新我的ruby版本.知道什么是错的吗?我曾尝试在网上四处寻找,但有点卡住,特别是因为我之前从未使用过rails,只有一点红宝石.



1> jrochkind..:

你的红宝石环境中有些东西变得怪异/腐败.我责备rvm.就个人而言,我不是rvm的粉丝.

但您可以尝试gem uninstall json,按照提示卸载所有版本.然后bundle install又来了.希望你能得到修复.


您可以`gem pristine --all`自动卸载并重新安装当前环境中所有已安装的gem.这需要一段时间.巧合的是,你输出顶部的警告是推荐的,虽然它是出于不同的原因推荐它,让Spring更好地工作(我自己不使用Spring),我认为,推荐它是因为它注意到你已经安装了比你现在使用的更早版本的ruby的宝石,除了一些编译好的宝石之外通常都没问题.
推荐阅读
赛亚兔备_393
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有