postmodern / chruby

Changes the current Ruby
MIT License
2.87k stars 190 forks source link

Puma does not work with chruby with version same as system #357

Open iamrahil opened 8 years ago

iamrahil commented 8 years ago

I run Arch linux which has ruby-2.3.0 installed as the system ruby. I also installed ruby-2.3.0 with ruby-install for my rails app as the user. It installed it in $HOME/.rubies

When I execute rails server using the system ruby, it runs fine. But when I chruby into 2.3.0, puma crashes with the error

/home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/puma-2.15.3/lib/puma/server.rb:15:in `require': incompatible library version - /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/puma-2.15.3/lib/puma/puma_http11.so (LoadError)
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/puma-2.15.3/lib/puma/server.rb:15:in `<top (required)>'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/puma-2.15.3/lib/puma.rb:14:in `require'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/puma-2.15.3/lib/puma.rb:14:in `<top (required)>'
        from /home/rahil/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
        from /home/rahil/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
        from /home/rahil/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
        from /home/rahil/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
        from /home/rahil/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
        from /home/rahil/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
        from /home/rahil/.gem/ruby/2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
        from /home/rahil/rails_dir/config/application.rb:7:in `<top (required)>'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `require'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `block in server'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
        from /home/rahil/rails_dir/bin/rails:25:in `require'
        from /home/rahil/rails_dir/bin/rails:25:in `<top (required)>'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/spring-1.6.2/lib/spring/client/rails.rb:28:in `load'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/spring-1.6.2/lib/spring/client/rails.rb:28:in `call'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/spring-1.6.2/lib/spring/client/command.rb:7:in `call'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/spring-1.6.2/lib/spring/client.rb:28:in `run'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/spring-1.6.2/bin/spring:49:in `<top (required)>'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/spring-1.6.2/lib/spring/binstub.rb:11:in `load'
        from /home/rahil/rails_dir/vendor/bundle/ruby/2.3.0/gems/spring-1.6.2/lib/spring/binstub.rb:11:in `<top (required)>'
        from /home/rahil/.rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/rahil/.rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/rahil/rails_dir/bin/spring:13:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'

Am I missing something?

barnett commented 8 years ago

@iamrahil how were you able to get past this error? hitting it myself right now.

iamrahil commented 8 years ago

I had to remove all gems I installed via the system ruby in my home directory On 08-Mar-2016 10:00 AM, "Barnett Klane" notifications@github.com wrote:

@iamrahil https://github.com/iamrahil how were you able to get past this error? hitting it myself right now.

— Reply to this email directly or view it on GitHub https://github.com/postmodern/chruby/issues/357#issuecomment-193600049.

barnett commented 8 years ago

@iamrahil yup, hit that last night. I ended up having rvm and rbenv both installed on an old computer. Removed the .gem and .rvm directory and seems to work perfectly now. Thanks!

postmodern commented 8 years ago

What is head -n1 home/rahil/rails_dir/bin/spring? I suspect spring is running under system ruby instead of .rubies/ruby-2.3.0.

iamrahil commented 8 years ago

What is head -n1 home/rahil/rails_dir/bin/spring?

#!/usr/bin/env ruby

rails console works. It also preloads via spring