0
eze@eze:~/Appp$ rbenv local
rbenv: no local version configured for this directory
eze@eze:~/Appp$ rbenv global
2.2.1
eze@eze:~/Appp$ rbenv versions
* 2.2.1 (set by /home/eze/.rbenv/version)

I recently uninstalled and reinstalled ruby with rbenv, but when I installed again I realized that everything worked except from the rails console, this is the output error

/home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- set (LoadError) from /home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/index.rb:1:in
`<top (required)>' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/source/rubygems.rb:204:in `fetch_specs' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/source/rubygems.rb:66:in `specs' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/lazy_specification.rb:53:in
  `__materialize__' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/spec_set.rb:88:in `block in materialize' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/spec_set.rb:85:in `map!' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/spec_set.rb:85:in
  `materialize' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/definition.rb:133:in `specs' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/definition.rb:178:in `specs_for' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/definition.rb:167:in
  `requested_specs' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/environment.rb:18:in `requested_specs' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/runtime.rb:13:in `setup' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler.rb:120:in
  `setup' from /var/lib/gems/1.9.1/gems/bundler-1.6.5/lib/bundler/setup.rb:7:in `
  <top (required)>' from /home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require' from /home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require' from /home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in
    `require' from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/commands.rb:33:in `
    <module:Spring>' from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/commands.rb:4:in `
      <top (required)>' from /home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/server.rb:9:in
        `
        <top (required)>' from /home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require' from /home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require' from /home/eze/.rbenv/versions/2.2.1/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in
          `require'
Nic
  • 6,211
  • 10
  • 46
  • 69
xeitor
  • 368
  • 4
  • 15
  • What is your question? – sawa Mar 08 '15 at 03:29
  • Thought that the tittle explained it, can not make my rails console work and i dont now how to. The obvious question would be how can I make my rails console work? @sawa – xeitor Mar 08 '15 at 03:42

1 Answers1

3

Solution:

Do gem update --system. It appears that you hadn't installed an updated version of rubygems to go with your new version of Ruby.

Sorry I took so long to get to a solution that worked for you, it seems more obvious now. :)


Original Answer:

Have you made sure that the global (or possibly local, if you have one set) Ruby version is set correctly with rbenv? Have you tried doing rbenv rehash.

It looks like you're missing the Set module in the Ruby standard library for some reason- but since I believe it is part of the standard library and should be there unless your Ruby installation is somehow broken, it makes me wonder if the shims installed by rbenv might be pointing at the wrong place. rbenv rehash should fix that problem, I believe, if that is the cause.

Otherwise, is there any more information about your environment you can give? Such as the output of

rbenv local
rbenv global
rbenv versions

Also, how are you starting the rails console? Are you doing rails console in your project's directory?

If you start irb and then do require 'set', does it work, or does it throw an error?

glaukommatos
  • 131
  • 4
  • rbenv rehash did not work, but I will but that outoputs you told me – xeitor Mar 06 '15 at 21:59
  • Ah and require "set" says true, yes I am doing rails console in my work directory – xeitor Mar 06 '15 at 22:01
  • I've noticed that in that error, there are a lot of references to gems in `/var/lib/gems`, whereas your Ruby installation looks to be in `~/.rbenv/`, which might be part of the problem. Can you show us the output of running `env` in your console? Specifically I wonder if you have GEM_PATH or GEM_HOME or any Ruby-specific variables set in ways that are breaking things. – glaukommatos Mar 06 '15 at 22:09
  • Another thing that may help is doing `gem install bundler`- that way you'll have bundler installed the your rbenv version of Ruby. If you do `which bundle` and it doesn't point to somewhere in your `~/.rbenv` directory, I'd imagine you might be having some trouble because of that as well. If you do `which bundle` and `which ruby`, that might be helpful to in determining where your Ruby is installed and if the system is using the right one. – glaukommatos Mar 06 '15 at 22:10
  • I posted the output of env, take a look – xeitor Mar 06 '15 at 22:15
  • What happens if you do `type rbenv`? I don't see anything in the output of `env` that should be causing any trouble (although I could always be missing something). – glaukommatos Mar 06 '15 at 22:16
  • There I posted the output of rbenv. PD: This is driving me crazy – xeitor Mar 06 '15 at 22:20
  • If you do `type rbenv` does your console say `function`? The `type` command in Bash will tell us what rbenv is according to bash- if it's loaded correctly, it should be a function. I'd suggest trying: `gem install bundle` and then `bundle install` and then trying to run the rails console again. Perhaps even trying `bundle exec rails console` in your project directory might be useful to see if that works. That will ensure that rails console is run in the same environment like your rails app would. – glaukommatos Mar 06 '15 at 22:21
  • Yes It does say that is a function, I will follow the steps and tell you in a minute – xeitor Mar 06 '15 at 22:24
  • Did not work, but when I use rails server o console this always appears Warning: You're using Rubygems 1.8.23 with Spring. Upgrade to at least Rubygems 2.1.0 and run `gem pristine --all` for better startup performance. @glaukommatos – xeitor Mar 06 '15 at 22:56
  • It looks like your machine is trying to use the wrong version of rubygems. I keep expecting `bundle install` to install the latest version of rubygems, but maybe this isn't something that would happen. What happens if you do `gem update --system`? Another thing that might help is doing `bundle update` instead of just `bundle install`. If you haven't already done so, I'd suggest reloading your terminal to see if there's any old environmental variable that just got stuck somewhere. – glaukommatos Mar 06 '15 at 23:15
  • I have just done gem update system, I will do run the other commands and tell you if it worked – xeitor Mar 06 '15 at 23:19
  • It worked!!! You are a very good ruby error tracer, post it as an answer so I can give you points – xeitor Mar 06 '15 at 23:43