Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialzacharysmith3
6,148 PointsCannot create new rails app due to Gem::LoadError (missing 'railties')
I got all the way to the step where I type rails new testapp, but when I do I get the following error:
/Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/dependency.rb:296:in to_specs': Could not find 'railties' (>= 0) among 19 total gem(s) (Gem::LoadError)
from /Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/dependency.rb:307:in
to_spec'
from /Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in gem'
from /Users/bastian/.rbenv/versions/2.0.0-p353/bin/rails:22:in
<main>'
It looks like the railties gem is missing, so I try to install it. I do so by typing sudo gem install railties. (It tells me I don't have permission to install without sudo.)
I then try to create the rails app again, same error message. When I list the gems using gem list, here's what I get:
*** LOCAL GEMS ***
bigdecimal (1.2.0, 1.1.0) bundler (1.3.5) bundler-unload (1.0.1) io-console (0.4.2, 0.3) json (1.7.7, 1.5.5) minitest (4.3.2, 2.5.1) psych (2.0.0) rake (10.1.0, 0.9.6, 0.9.2.2) rdoc (4.0.0, 3.9.5) rubygems-bundler (1.2.0) rvm (1.11.3.8) test-unit (2.0.0.0)
I don't see railties on this list. Or rails or sqlite3, for that matter. Should I see them listed? I typed the commands to install them, as per the instructions.
One other possible clue. I listed the path using echo $PATH, resulting in the following:
/Users/bastian/.rbenv/shims:/Users/bastian/.rbenv/bin:/usr/local/rvm/gems/ruby-1.9.3-p429/bin:/usr/local/rvm/gems/ruby-1.9.3-p429@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p429/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
I see what looks like an older version of ruby in there. And also rvm. Is this an issue? Maybe rvm and rbenv are fighting? Maybe different versions of ruby are fighting? I'm shooting in the dark here.
I'm totally new at this, and I'm really stuck at this point. Any help is most appreciated.
3 Answers
David Ker
14,439 PointsRight off the bat, yes, RVM and rbenv are fighting, and are most likely at least part of your problem. When I get back on my laptop, I'll post a couple links I found helpful to uninstall rvm, since rbenv seems to be the most useful ruby version manager of the two.
David Ker
14,439 PointsSorry, I thought I had the links stashed in Evernote, but I can't find them! This one is the big one, actually removing RVM from your system - http://stackoverflow.com/questions/3558656/how-can-i-remove-rvm-ruby-version-manager-from-my-system
The other link I had was to reset your PATH
, .bashrc
, and .profile
files. Are you familiar with how to edit those, and take out references to RVM? If not, I can try to walk you through it.
zacharysmith3
6,148 PointsStill not quite there, but I think I'm making progress(?)
I followed the instructions in your link to remove rvm:
rvm implode
and
gem uninstall rvm
Then I found these instructions for editing the PATH variable. I ended up explicitly defining the PATH in .bash_profile. The path used to be this:
/Users/bastian/.rbenv/shims:/Users/bastian/.rbenv/bin:/usr/local/rvm/gems/ruby-1.9.3-p429/bin:/usr/local/rvm/gems/ruby-1.9.3-p429@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p429/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
And after removing references to rvm, it reads:
/Users/bastian/.rbenv/shims:/Users/bastian/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
I accomplished this by editing the .bash_profile file to read:
export PATH="/Users/bastian/.rbenv/shims:/Users/bastian/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin"
eval "$(rbenv init -)"
But even after all that, the issue persists. I install railties:
sudo gem install railties
That seems to work. Then I try to create a new rails app:
rails new testapp
And I get this error:
/Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (>= 0) among 19 total gem(s) (Gem::LoadError)
from /Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /Users/bastian/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /Users/bastian/.rbenv/versions/2.0.0-p353/bin/rails:22:in `<main>'
I'm totally at a loss. I managed to install the Treehouse VM and so I'm able to continue with the Rails courses that way, but I'd like to get to the point where I can set up the dev environment on my actual computer.
Sorry for the long post! In case we end up figuring it out I wanted to spell it out so it can serve as a resource to other folks down the line.
David Ker
14,439 PointsAny progress is good progress! Some people like to say "new errors!!"
What do you get when you run which ruby
and which rails
in your terminal?
zacharysmith3
6,148 Pointszacharysmith3
6,148 PointsThanks, David! I'll look for your links.