Weird gem issues

I have created many rails projects successfully on Windows and OSX over the past 8 years or so. I’m trying to create my first project on CentOS and I’m getting the strangest errors. I have installed rails 4.1.4 and rake 10.3.2.

rake -v returns:
Could not find gem ‘rails (= 4.1.4) ruby’ in the gems available on this machine.

Run bundle install to install missing gems.

gem list rails* returns

*** LOCAL GEMS ***

coffee-rails (4.0.1)

jquery-rails (3.1.1)

rails (4.1.4)

railties (4.1.4)

sprockets-rails (2.1.3)

bundle install returns:

Bundler::GemspecError: Could not read gem at /src/opsdocs/vendor/bundle/ruby/2.1.0/cache/rake-10.3.2.gem. It may be corrupted.

/usr/local/rvm/gems/ruby-2.1.1@global/gems/bundler-1.6.2/lib/bundler/vendor/thor/shell/basic.rb:355: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-2.1.1 in PATH, mode 042777

An error occurred while installing rake (10.3.2), and Bundler cannot continue.

Make sure that gem install rake -v '10.3.2' succeeds before bundling.

rails s returns

/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/dependency.rb:298:in `to_specs’: Could not find ‘railties’ (>= 0) among 8 total gem(s) (Gem::LoadError)

from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/dependency.rb:309:in `to_spec’

from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem’

from /usr/local/rvm/gems/ruby-2.1.1/bin/rails:22:in `’

from /usr/local/rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval’

from /usr/local/rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `’

I have uninstalled and reinstalled rake 10.3.2 several times.

WTF? Any ideas?



I’ve seen this before when I was missing some (but not all) of the right executables on my PATH. gem list would show one set of gems, but rake would pick up an entirely different set in the system Ruby (or vice versa). Run which ruby etc and see what doesn’t line up.

–Matt Jones