Ruby Mine complains that "Cannot switch SDK." even if the SDK is there and available

StackOverflow https://stackoverflow.com/questions/23171956

  •  06-07-2023
  •  | 
  •  

Question

My Ruby Mine 6.0.3 gives the message:

Project .ruby-version Settings: Cannot switch SDK. RVM SDK '2.1.1@rails3' wasn't found.

I manage ruby environments with rvm.
The wanted environment seems to be ok:

rvm gemset list

gemsets for ruby-2.1.1 (found in /home/agostino/.rvm/gems/ruby-2.1.1)
    (default)
    global
    rails3 
=>  testproject

Not only this, but also Mine seems to access the rvm environments quite well since opening File, Settings i can see:

Ruby Mine 6.03, File, Settings, Ruby SDK and Gems

So why can't it switch to the correct environment?

If, in the form above, I select it manually, it seems to work fine. But the "cannot switch..." message still appears each time I open the project.

Était-ce utile?

La solution

I found for a similar problem (Rubymine 6.3.1 and Ruby 2.1.1) that I had to format .ruby-version in the following way:

ruby-2.1.1

Note the prefix 'ruby-" to the version number. I'm not sure whether this is an RVM, Ruby, Rubymine, or some other issue that caused this problem, but the fix I mentioned worked on my Mac.

Autres conseils

I am not sure if this is the case, but you might be telling rubymine to use a different ruby version, and it uses that version on all the commands, that's why it shows the errors on each interaction with ruby.

You need to change the running configuration, from the menu choose: Run > Edit configuration

Then you'll find few settings on the left, choose the one that you use to run your project, and on the right check for Ruby SDK, choose the correct ruby version from the list, and click ok. Every thing should be fine, you might need to bundle because gems aren't shared between different ruby versions.

FYI this issue has been already reported to JetBrains RUBY-15058 and it seems they will work on adding "ruby-" prefix if missing.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top