新手问题 懵逼了,求帮助,有谁遇到过这个问题么?「in `require': incompatible library version」

brucewzp · 2016年05月27日 · 最后由 brucewzp 回复于 2016年05月27日 · 3552 次阅读

昨晚改了当前用户目录名,新建个 rails 项目,rails s就懵逼了
console.log:

/Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/debug_inspector-0.0.2/lib/debug_inspector.rb:6:in `require': incompatible library version - /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/debug_inspector-0.0.2/lib/debug_inspector.bundle (fatal)
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/debug_inspector-0.0.2/lib/debug_inspector.rb:6:in `<top (required)>'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/binding_of_caller-0.7.2/lib/binding_of_caller/mri2.rb:1:in `require'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/binding_of_caller-0.7.2/lib/binding_of_caller/mri2.rb:1:in `<top (required)>'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/binding_of_caller-0.7.2/lib/binding_of_caller.rb:9:in `require'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/binding_of_caller-0.7.2/lib/binding_of_caller.rb:9:in `<top (required)>'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/web-console-2.3.0/lib/web_console.rb:1:in `require'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/web-console-2.3.0/lib/web_console.rb:1:in `<top (required)>'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/web-console-2.3.0/lib/web-console.rb:1:in `require'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/web-console-2.3.0/lib/web-console.rb:1:in `<top (required)>'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
    from /Users/brucewzp/develop/rubydev/temp/config/application.rb:7:in `<top (required)>'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0@global/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/brucewzp/develop/rubydev/temp/bin/rails:9:in `require'
    from /Users/brucewzp/develop/rubydev/temp/bin/rails:9:in `<top (required)>'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `load'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/client/rails.rb:28:in `call'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/client/command.rb:7:in `call'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/client.rb:30:in `run'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/bin/spring:49:in `<top (required)>'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `load'
    from /Users/brucewzp/.rvm/gems/ruby-2.3.0/gems/spring-1.7.1/lib/spring/binstub.rb:11:in `<top (required)>'
    from /Users/brucewzp/develop/rubydev/temp/bin/spring:13:in `require'
    from /Users/brucewzp/develop/rubydev/temp/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

我重装了 rvm,还是这样。。。求各位指条明路。。。

一般都是 gem 版本、ruby 版本不兼容所致。分别看下如下输出,看看是否是你想要的: rvm list rvm gemset list

#1 楼 @qinfanpeng 确实是这问题,切换 gemset 到 global 解决问题。十分感谢!

#2 楼 @brucewzp 很高兴能帮到你,不过建议是一个项目对应一个gemset而非都用 global 这个 gemset,这样可以确保每个项目相互独立,互不影响。你可在项目根目录下建立以来两个文件,一般来说命令行会自动帮你切换:

# .ruby-version
ruby-2.2.2  # 指定版本

# .ruby-gemset
project_name  # 指定gemset

#3 楼 @qinfanpeng 我手动清理了 default 的 gems,现在切回去了,再次感谢

需要 登录 后方可回复, 如果你还没有账号请 注册新账号