Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gem install rails does not install rails

When I tries to install rails:

root@li44-48:/# 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...

But when I do:

root@li44-48:/# rails
-bash: rails: command not found

I checked gem env and it displays:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.15
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [i686-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.9.1
     - /root/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

Also the folder root@li44-48:/usr/lib/ruby/gems/1.9.1/gems/rails-3.2.1# is empty.

Any ideas on how to fix this?

like image 441
Bill Avatar asked Feb 06 '12 20:02

Bill


People also ask

Why gem is not working?

If you're using the app and experiencing issues, try deleting it, powering off your device for a minute, and reinstalling the app. Doing this can sometimes clear up minor issues.

What is the difference between gem install and bundle install?

Almost seems like running 'gem install' adds it to the global available gems (and hence terminal can run the package's commands), whereas adding it to the gemfile and running bundle install only adds it to the application. Similar to npm install --global. that's basically it.

What does gem install Rails do?

Installing Gems The install command downloads and installs the gem and any necessary dependencies then builds documentation for the installed gems. Here the drip command depends upon the rbtree gem which has an extension.


1 Answers

I had the same issue after switching to an older version of Rails (3.2.16) from 4.0.2.

In my case it looks like railties need to be uninstalled as well - not just the rails gem.

Here's what I've done:

gem uninstall rails # choose to remove all
gem uninstall railties # choose to remove all
gem install rails -v 3.2.16
like image 172
Felix Tjandrawibawa Avatar answered Sep 27 '22 19:09

Felix Tjandrawibawa