Rails: Could not find railties

Ruby on-RailsRubygems

Ruby on-Rails Problem Overview


➜  ~  rvm -v

rvm 1.10.2 by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.beginrescueend.com/]

➜  ~  ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
➜  ~  rails -v
/Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
	from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
	from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
	from /Users/hb/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in `<main>'
➜  ~  

I installed a clean installation of ruby just now, and rails, I removed all my previous gems, and I still keep getting this error. Any ideas ? And yes, I had this error before, and this is what I did

A little more info:

➜  ~  gem list

*** LOCAL GEMS ***

actionmailer (3.2.1)
actionpack (3.2.1)
activemodel (3.2.1)
activerecord (3.2.1)
activeresource (3.2.1)
activesupport (3.2.1)
arel (3.0.0)
builder (3.0.0)
bundler (1.0.22 ruby)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.1)
json (1.6.5)
mail (2.4.1)
mime-types (1.17.2)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1)
railties (3.2.1)
rake (0.9.2.2, 0.9.2)
rdoc (3.12)
sprockets (2.3.0, 2.1.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)

➜  ~  gem install rails
Successfully installed rails-3.2.1
1 gem installed
Installing ri documentation for rails-3.2.1...
Installing RDoc documentation for rails-3.2.1...
➜  ~  rails -v
/Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
	from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
	from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
	from /Users/hb/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in `<main>'
➜  ~  

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

It means your Rails installation is corrupted or incomplete. If you list your gems, chances are you won't find railties

$ gem list

Run the command

$ gem install rails

again. It will download and install missing dependencies, including railties.

Solution 2 - Ruby on-Rails

I ran into the same problem and, in my case, it turned out to be because I had installed using sudo - it does not necessarily make rails available to ordinary users. Try running just gem install rails if you previously ran sudo gem install rails.

Solution 3 - Ruby on-Rails

Worked for me

rvm reinstall 1.9.3

then

gem install rails

Solution 4 - Ruby on-Rails

I ran into this same issue. If you're using RVM it's possible you switched to the wrong Ruby version which causes a gem load error if the directory uses a different version than the one you are currently set to use.

To fix, type rvm use -yourrubyversion in the app's directory in terminal. For example, if your app is set up to use ruby 1.9.3 type rvm use -1.9.3.

RVM works by separating your gems by ruby version by app, so if you switch to a different ruby version RVM will separate previously used and installed gems from the different ruby version, which is why you may be seeing tho issue.

Solution 5 - Ruby on-Rails

rvm implode was the answer. Something probably went wrong before, now everything works after a rvm reinstall.

Solution 6 - Ruby on-Rails

Maybe you installed two or more version of rails and railties.

gem uninstall railties
gem uninstall rails

then reinstall.

Solution 7 - Ruby on-Rails

I got the same error when I installed ruby 1.9.3p194

and then I reinstalled ruby and rails

Solution 8 - Ruby on-Rails

Simone's answer is great. However, if you already have your Rails gem in your Gemfile, just try to use bundle exec instead:

bundle exec rails c

And that should suffice. If not, then add

bundle install

before the mentioned command.

Solution 9 - Ruby on-Rails

I also had this issue after I installed ZSH (Wanted to mess with it's templates.)

Ran

brew update

which did find some updates I wasn't missing before, but in the end

gem install rails

suddenly completely re-installing the rail/ties system. Unsure why ZSH removed it.

Solution 10 - Ruby on-Rails

Uninstalling ruby, and railsinstaller and then installing railsinstaller again worked great for me!

Solution 11 - Ruby on-Rails

I did 'gem install rails' on my system (ubuntu) and it installed the missing gems approx 28 of them then i did 'gem list' to check and it was all there.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpyronaurView Question on Stackoverflow
Solution 1 - Ruby on-RailsSimone CarlettiView Answer on Stackoverflow
Solution 2 - Ruby on-RailsArkaaitoView Answer on Stackoverflow
Solution 3 - Ruby on-RailsHaris KrajinaView Answer on Stackoverflow
Solution 4 - Ruby on-RailsVerdi Erel ErgünView Answer on Stackoverflow
Solution 5 - Ruby on-RailspyronaurView Answer on Stackoverflow
Solution 6 - Ruby on-RailszhoubaozhouView Answer on Stackoverflow
Solution 7 - Ruby on-Railsvidur punjView Answer on Stackoverflow
Solution 8 - Ruby on-RailsvalkView Answer on Stackoverflow
Solution 9 - Ruby on-RailsDNorthrupView Answer on Stackoverflow
Solution 10 - Ruby on-RailssaadaView Answer on Stackoverflow
Solution 11 - Ruby on-RailsknaijaView Answer on Stackoverflow