1

I have encountered a problem where I create a ruby-on-rails application using RubyMine v7.0 and when I go to run, I get prompted with

C:/ruby-2.0.0-p643-x64-mingw32/lib/ruby/gems/2.0.0/gems/bundler-1.9.1/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find json-1.8.2 in any of the sources (Bundler::GemNotFound)

and when I run

gem install 'json'

it succeeds but gives the same error even when I run the app again, even after running 'bundle install'.

when I use bundle show 'json' it shows the gem location to be

C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/json-1.8.2

which is different from the location RubyMine is looking in

C:/ruby-2.0.0-p643-x64-mingw32/lib/ruby/gems/2.0.0/gems

How do I change the directory that gems are installed to to the correct one stated above? any suggestions are much appreciated :)

side note: I'm running on Windows 8

Danoram
  • 8,132
  • 12
  • 51
  • 71
  • Fellow Windows user, bummed to hear you're having this issue! What do you get when you execute `bundle show json` at the command line? – Dan Wagner Mar 28 '15 at 03:49
  • `D:\Programming\RUBY\RubyMine\Test_app_4>bundle show json` `DL is deprecated, please use Fiddle` `C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/json-1.8.2` – Danoram Mar 28 '15 at 04:34
  • ^on a side note, how do you add linebreaks to a comment? lol – Danoram Mar 28 '15 at 04:38

1 Answers1

1

Sorry to prequalify this answer, but I can't speak to how RubyMine sets up gems and the gem environment. That said, you can control where gems are installed by manipulating the GEM_HOME environment variable.

On Windows, set creates a user variable.

> set GEM_HOME=c:\your_target_folder

With GEM_HOME assigned, gem install xyz will install the gem to the directory you specified.

> gem install xyz

gem_home_example

Dan Wagner
  • 2,693
  • 2
  • 13
  • 18
  • I haven't tried implementing this yet as I tried creating a rails app with the ruby version from the directory the gems were installing to and it seems to work now... but I will make this the accepted answer as I am confident it answers my question! – Danoram Mar 29 '15 at 10:37