Rails Installation Error - ruby-on-rails

I've been getting this error after installing rvm and rails with rvm. Can anyone help me out?
/Library/Ruby/Site/1.8/rubygems.rb:779:in report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError) from /Library/Ruby/Site/1.8/rubygems.rb:214:in activate' from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem' from /usr/bin/rails:18
Thanks!

Couple of things to look at:
Make sure Rails is indeed installed. I'm bringing up this point because you mentioned that you installed Rails with RVM, which is inaccurate. You install Rubies with RVM but you install Rails with Bundler (you can see Bundler as an RVM for gems rather than rubies). So ensure that you have a line that says gem 'rails' in your Gemfile and then run bundle install.
As pointed out by other answers, make sure you are using the right ruby and gemset (where you installed the Rails gem). To do so run rvm use <your_ruby>#<your_gemset>.

Are you sure you're actually in the RVM Ruby right now? I often hit this error when I forget to enter rvm use MY_RUBY_VERSION. It's looking for the rails gem, but can't find it.

Related

Getting rails error

I previously installed rails with the preinstalled ruby that comes with mac. I have recently installed ruby through rvm.
I then did
rails -v
and got the following error
kingsosina$ rails -v
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'railties' (>= 0) among 5 total gem(s) (Gem::LoadError)
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:309:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rails:22:in `<main>'
What has gone wrong here? Do I need to gem install rails again?
my lastest output
kingsosina$ which ruby
/Users/kingsosina/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
kingsosina$ which rails
/Users/kingsosina/.rvm/gems/ruby-2.0.0-p353/bin/rails
kingsosina$ which gem
/Users/kingsosina/.rvm/rubies/ruby-2.0.0-p353/bin/gem
kingsosina$
Does everything seem ok? and how does terminal know to reference this version of ruby instead of the pre-installed version on the mac, when i do ruby -v?
For what it's worth, the paths shown in your error output indicate that you're still referencing the OSX version of ruby. You'll want to enter the directory and type
rvm use X.X.X-pXXX
where X.X.X-pXXX is the ruby version that you want rvm to use. You can also add a file called .ruby-version with X.X.X-pXXX in it and rvm and other ruby version managers will switch to the appropriate version for you. Adding a .ruby-gemset file will also switch to the appropriate set of gems.
Finally, you'll need to make sure that the gems are installed in the rvm ruby/gemset combination. Putting that all together, to get started with the latest ruby and latest rails gem you would...
rvm install 2.0.0
rvm use 2.0.0
rvm gemset use --create my-project-gems
gem install rails
Did you install newer version of ruby along with the rvm install? Do rvm list to find out what rubies your have installed. Then do rvm use <ruby-version-here> to select a ruby with rvm. Then you need to gem install rails again because its a new ruby. If you get a permission denied error trying to install gems try rvmsudo gem install rails.

Could not find RubyGem railties

I try to create new app with "rails new" command however getting this error:
'report_activate_error': Could not find RubyGem railties (>= 0) (Gem::LoadError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:244:in 'activate_dep'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:236:in `activate'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1307:in `gem'
from /usr/local/bin/rails:18
Any idea why?
by the way I am working on Ubuntu
gem list
*** LOCAL GEMS ***
it is empty but I installed rails just before
I have encountered the issue before.The solution is :
you must use comand gem install rails, not sudo gem install rails.
I encountered the same problem and found the following solution Here which was mentioned here. Hope it helps
After you installed RVM and after you set the default Ruby version in RVM, you need to re-install all ruby gems, e.g.
gem install rails
you need to install those gems as the user, not as root.
Because from now on RVM will keep track of all installed gems by the ruby version which was used to install them!
You need to install RVM (I don't know it is the best solution but it works) then use such rails commands like rvmsudo rails new or such. I use rails and ruby command with including rvm or rvmsudo phase and all of them start to work.
Do you have multiple Ruby installations on your system? Maybe you have installed some package (like Heroku with full installation) and you are using the 'new' Ruby installation. I have uninstalled the last Ruby and everything seems to be fine.
Edit: Not everything is fine... yet. Under Windows you will have to edit Heroku.bat (in your Program Files/Heroku path) and change the path to Ruby installation folder.
Install rvm and try it again to install rails
RVM provides a very great way to manage your gems in Gemsets
for multible ruby installations.
On the offizial rvm site is a installation tutorial
http://beginrescueend.com/

Could not find RubyGem bundler

I've cloned diaspora for github, git://github.com/diaspora/diaspora.git
I tried to install it. An error generated when I use bundle install.
$ bundle install
/usr/local/lib/site_ruby/1.8/rubygems.rb:812:in `report_activate_error': Could not find RubyGem bundler (>= 0) (Gem::LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems.rb:223:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:1146:in `gem'
from /usr/bin/bundle:18
I'm using rails 3 and ruby 1.8 on ubuntu 11.04. How to fix it? Please help
Did you install bundler gem?
$ gem install bundler
You might need sudo privileges.
Hmm, maybe you've got the bundle command and bundler gem installed for /usr/bin/ruby, and after that installed another Ruby in /usr/local/bin/ruby?
Could you do a which ruby and head -1 /usr/bin/bundle? Maybe also a gem list?
Presumably this has been fixed long ago, but for the benefit of others....
My issues was that while I had installed the bundler gem it had been installed in a different location to the current GEM_PATH - so it couldn't be found.
So,
GEM_PATH=/usr/lib/ruby/gems/1.8/ bundle install
did the business, setting the value of GEM_PATH to the actual location of the gems folder where the bundler gem has been installed.

Bundler is ghost-bundling - it uses the gem but passenger returns a GemNotFoundError

I'm using Rails 2.3.11 and Bundler 1.0.10.
Passenger returns the error
Could not find addressable-2.2.4 in any of the sources (Bundler::GemNotFound)
I installed manually addressable 2.2.4 and I bundled it with gem 'addressable', '2.2.4' did a bundle install and bundler says Using addressable (2.2.4).
Still there is the error of above.
I'm using Passenger as an Apache2 module. I'm using RVM with Ruby 1.9.2. Passenger runs with 1.8.7. Even switching Ruby to 1.8.7 using RVM doesn't solve the problem.
Along with what Zachary said, that is making sure you have the right gemset selected, be sure to run
bundle install
in the directory of the project. In my case for a Padrino project, once i ran bundle, it worked fine (with that gemset selected).
If you're using RVM there's a good chance your gemset for your project is not synched up.
Try doing
rvm gemset list
If you created a ruby for this project and a gemset for it, it will be listed there. Do
rvm gemset use nameOfGemsetForYourProject
RVM is a great tool, but it can muddy the waters and cause some confusion with making sure you're installing a gem under the correct namespace.
To check what gems are installed for a gemset, after you have done a 'use' on it, just type "gem list"

"File not found: lib" when switching to older rails version using RVM

I currently have rails 3.0.3 and am trying to download and use version 3.0.1. I've downloaded and installed RVM and inputted the following code in Terminal (I have a Mac OS X 10.6.5):
rvm use 1.8.7
rvm gemset create rails3.0.1
rvm 1.8.7#rails3.0.1
sudo gem install rails --version=3.0.1
I use sudo gems because of the user permissions, or my lack there of. Anyway, after I enter the last line of code: "sudo gem install rails --version=3.0.1" I get the following error:
Successfully installed rails-3.0.1
1 gem installed
Installing ri documentation for rails-3.0.1...
File not found: lib
Not only can I apparently not able to switch versions of rails, even though it appears as though I have multiple versions installed, every time I try to check to see what version of rails I currently have I get the following result:
rails -v
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems.rb:214:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem'
from /usr/bin/rails:18
Also, I've already installed Rdoc and Xcode (I've done research and other suggestions pointed to installing both). I'm a RoR newbie, and especially an RVM newbie, so I would love an explanation and a solution to this madness.
Thank you for reading!
I think you went off the rails (ha-ha) right here:
sudo gem install rails --version=3.0.1
The RVM documentation has this to say about that:
DO NOT use sudo...
to work with RVM gems. When you do
sudo you are running commands as root,
another user in another shell and
hence all of the setup that RVM has
done for you is ignored while the
command runs under sudo (such things
as GEM_HOME, etc...). So to reiterate,
as soon as you 'sudo' you are running
as the root system user which will
clear out your environment as well as
any files it creates are not able to
be modified by your user and will
result in strange things happening.
(You will start to think that someone
has a voodoo doll of your
application...)

Resources