I was trying to fix this error and I ended up with a new one.
I have installed ruby 1.8.6, but using Built-in JRuby 1.4.0 for my app.
Everything was working fine until I updated every gem(as specified by the answer I got from that link) and everything crashed: ever since I tried to start the app I received the following error message:
Missing the Rails 2.3.4 gem. Please
gem install -v=2.3.4 rails, update
your RAILS_GEM_VERSION setting in
config/environment.rb for the Rails
version you do have installed, or
comment out RAILS_GEM_VERSION to use
the latest version installed.
Then, I tried to uninstall the updates(to v2.3.8, most of them), so the last version is 2.3.4.
In my config/environment.rb file I have this:
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
so I guess everything is as I left it before the update.
The question is....why do I keep getting the error and I can't start the app?
Well, I got this working by changing the gem path for my Built-in Jruby 1.4.0 platform, pointing to the gems' directory of Ruby, instead of NetBeans(as it was before).
I hope it works well in the future.
Related
I started a Heroku Rails app using Ruby 1.9.3 and Rails 4.0.1.
I decided soon after to update my ruby version to 2.0.0 as this apparently works better with Rails 4.0.1. So, I installed the ruby2.0 package using apt-get and other associated packages, then I set ruby 2.0.0 as the default using sudo ruby-switch --set ruby2.0, finally I updated the Gemfile in my app, changing the line ruby '1.9.3' to ruby '2.0.0' Now, when I run bundle install I am presented with this error, and I don't know why...
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
Following this heroku guide didn't seem to help... I set the path to what is shown there and it didn't seem change anything. Maybe I am being stupid and there is something in that path that I need to replace something with information specific to my machine? I feel like the part where I set vendor/bundle/ruby/2.0.0/bin should have some specific info, like changing "vendor" to something but I don't know what... I'm not totally familiar with this stuff yet, this is my first time using heroku and ruby.
EDIT: I forgot to mention (in case it is important) I am running Xubuntu 13.10.
I believe I have fixed the issue. I was somehow running the bundle command which was installed for ruby 1.9.3... so when it compared the gemfile definition with the version it was running on they mismatched. Re-rerunning sudo gem install bundler has sorted it out.
I was working on a project just fine, logged off for the night and the next morning when I tried to start again I was getting this error:
Missing the Rails 2.3.12 gem. Please `gem install -v=2.3.12 rails`,
update your RAILS_GEM_VERSION setting in config/environment.rb
for the Rails version you do have installed, or comment out RAILS_GEM_VERSION
to use the latest version installed.
I did a gem list and it's definitely installed:
rails (3.1.0, 2.3.14, 2.3.12, 2.3.8)
I also made sure that 2.3.12 was the required Gem in the environment.rb:
RAILS_GEM_VERSION = '2.3.12' unless defined? RAILS_GEM_VERSION
Before I logged off I deployed my changes to demo, which was working fine, and when I checked it the next morning I was getting the same error message.
I'm still pretty new to RoR so I am not sure how to trouble shoot this.
I had this problem before and it was because I was defaulting to the system version of ruby. Run "ruby -v" in console and make sure you are using the version you want to. If you are not run this in the console:
$ rvm use "x"
Where "x" is the version of ruby you want to use.
Also, make sure your gemsets are in order. You can create and start using a new gemset by running this in the console ("xxx" = what you want to call your gemset):
$ rvm gemset create xxx
$ rvm gemset use xxx
After creating (and switching to) the gemset you can try reinstalling rails. Creating a new gemset means that there are no gems associated with whatever project you are working on anymore. So you will need to reinstall all your other gems too. Should be easy with a "bundle install"
Hope this helps.
I'm working on two different rails installations for two different projects. They are on different versions of rails. Here's what I have installed:
gem list --local | grep rails
shows that I have this installed:
rails (3.0.0.beta4, 2.3.5)
When I run a command to do a deployment for the app that uses 2.3.5, I get the following error:
Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your
RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do
have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
It's not finding the correct rails version, even though I have it installed. What are good short- and longer-term solutions for this problem?
I suggest you RVM. It allow you to have different ruby/gems versions on the same machine.
The long term solution is to look into rvm, especially the gemset feature makes it really easy to keep separate versions of gems and even ruby versions for different projects.
A short trem solution may be to add the the following line to your boot.rb file, somewhere before rails is required:
gem rails, "2.3.5"
This loads the right version of the gem, otherwise gem will think you want the latest version.
As others have noted, rvm is one way to solve this problem. The other is to use bundler, which involves some setup in your application and potentially requiring you to use 'bundle exec command' everywhere you want to run conflicting versions of a command (eg cucumber)
Some weeks ago I upgraded my NetBeans version from 6.7 to 6.8.
Yesterday, while trying to solve some issue, I updated the gems' versions and suddenly the app stop working, throwing me the error message:
Missing the Rails 2.3.4 gem. Please
gem install -v=2.3.4 rails, update
your RAILS_GEM_VERSION setting in
config/environment.rb for the Rails
version you do have installed, or
comment out RAILS_GEM_VERSION to use
the latest version installed.
Rails 2.3.4 is installed, and its specified correctly in environment.rb file as follows:
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
I spent hours trying to fix this, when I discovered I had gems both in my NetBeans directory and in the Ruby directory. So I changed the Gems Home to the Ruby directory(instead of the NetBeans dir) and the app magically started.
That being said, I think that's not the proper solution, because I'm using both directories and I guess it's bringing me problems. Fox example, I cannot send emails any more, as posted here.
Any help will be appreciated! Thanks in advance.
Why not keep gems in one place?
From your other post i'm assuming you're using windows so if you're not using pik (like rvm but for windows) then i don't see the point of 2 (or more) gem locations as it's obviously leading to problems.
I'm sticking with 1 gem location.
My rails project has this line in /config/environment.rb
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
As we now have 2.3.5 as the most recent upgrade, is there a way to make my environment.rb accept minor version bumps?
(without I have to explicitly change 2.3.2 to 2.3.5)
No, there isn't.
You application needs to use a specific Rails version mostly because different tiny releases might require additional steps to upgrade the framework such as changes to boot.rb.
$ rake rails:update
Things have evolved a bit since Rails 2, so Ill share what I had to do to get from 5.0.0 to 5.0.0.1 today.
My Gemfile read gem 'rails', '~> 5.0.0'. I figured that was enough, but bundle install was not updating anything new. So I tried to force it with gem 'rails', '~> 5.0' which also did nothing new when I ran update (note: this is for an experimental app of my own, and not someone else's app I am working on - don't just default to allowing minor version updates to solve problems like this ;) ). So I had to try a few other ways to force this security patch/hotfix.
First, I had to install the package locally:
gem install rails --version 5.0.0.1
Next, I updated bundler:
bundle install
...and I saw this in the output: Using rails 5.0.0.1 (was 5.0.0)
When I ran ./bin/rake rails:update, it wiped the contents of my config/routes.rb file, changed many of my settings in various config files (some of which were dangerous security settings to change), among a few other seemingly benign changes. While this is the expected behavior, I am pointing this out as not exactly a desirable method for updating a minor patch/hotfix for rails.
Firstly, you need to change the version to 2.3.5 from 2.3.5 and then run
rake rails:update