pyronaur
pyronaur

Reputation: 3545

Rails: Could not find railties

➜  ~  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>'
➜  ~  

Upvotes: 55

Views: 94773

Answers (11)

DNorthrup
DNorthrup

Reputation: 847

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.

Upvotes: 2

Haris Krajina
Haris Krajina

Reputation: 15266

Worked for me

rvm reinstall 1.9.3

then

gem install rails

Upvotes: 16

knaija
knaija

Reputation: 34

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.

Upvotes: 0

vidur punj
vidur punj

Reputation: 5861

I got the same error when I installed ruby 1.9.3p194

and then I reinstalled ruby and rails

Upvotes: 5

zhoubaozhou
zhoubaozhou

Reputation: 81

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

gem uninstall railties
gem uninstall rails

then reinstall.

Upvotes: 8

valk
valk

Reputation: 9874

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.

Upvotes: 2

saada
saada

Reputation: 2761

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

Upvotes: 0

Arkaaito
Arkaaito

Reputation: 7387

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.

Upvotes: 36

Verdi Erel Erg&#252;n
Verdi Erel Erg&#252;n

Reputation: 1051

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.

Upvotes: 15

pyronaur
pyronaur

Reputation: 3545

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

Upvotes: 14

Simone Carletti
Simone Carletti

Reputation: 176352

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.

Upvotes: 101

Related Questions