Getting App Crashed error when deploying Rails application to Heroku - ruby-on-rails

I followed all the guidelines given on the heroku blog for deploying a Rails app. I also my app got pushed successfully and created an app in my account. But when I try to run my site it gives me the following error:
App crashed
This application is temporarily offline.
If you're the administrator of this app, please check your heroku logs for the
backtrace.
I tried to check the logs and here's what I got
C:\Users\raw\Desktop\html\rohit>heroku logs
Missing the Rails 2.3.8 gem. Please `gem install -v=2.3.8 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.
==> dyno-3674485.log (crash) <==
Missing the Rails 2.3.8 gem. Please `gem install -v=2.3.8 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 can't find the expected version.
Check to ensure you have specified the correct version of Rails in your
Gemfile or .gems. See http://docs.heroku.com/gems for details.
You may also be affected by a gem dependency issue with rack.
See http://docs.heroku.com/gem-dependency for details.
Examine the backtrace above this message to debug.
II have made a .gems file in my Rails_App directory:
rails -v '2.3.8'
pg
rack -v '1.1.0'
haml -v '3.0.13'
formtastic -v '0.9.8'
authlogic -v '2.1.5'
subdomain-fu -v '0.5.4'
compass -v '0.10.2'
compass-colors -v '0.3.1'
paperclip -v '2.3.3'
activemerchant -v '1.9.0'
icalendar
What can I do to get this to work?

Rails 2.3.8 is not compatible with rack 1.2.1 You can't define you .gems like that you have a "gem dependency issue with rack" like define.
Try with rake -v=1.1.0 the dependency of ActionPack 2.3.8 ( http://rubygems.org/gems/actionpack/versions/2.3.8)

My Heroku app, running on bamboo-ree-1.8.7 stack, (run heroku info to determine what stack you are running), I have the following configuration:
first line of my .gems file
rails --version 2.3.8
You may also need to add the following to your config/environment.rb file
config.gem 'rails', :version => '2.3.8'
You will need to do another git push to heroku for these changes to take effect.

I added the command to ignore depedencies in the .gems file as --ignore-depedencies and now it works thanks guyz for your time.
The issue is solved.
PS: I had kept the solution as a comment, now submitting it as an answer.

Related

rails -v keeps saying Rails 3.2.13 after installing 4.2.2

What gives?
I typed this in gem install rails -v 4.2.2
After that, I tried rails -v, and it keeps coming out Rails 3.2.13
Why is this?
My ruby version after ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
You can manage gems with bundler (http://bundler.io/)
Put this on your Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem install bundler
and then
bundle install
bundle exec rails -v
If you still working without bundler, you can make
gem list
look at your rails version and then uninstall older versions
gem uninstall rails --version 3.2.13
and then
rails -v
I've encountered this before. And this is what I did.
Change version of rails
Just change the versions.
If you have multiple versions of Rails installed, you'll get conflicting information like this.
If you need to run a command with a specific version of Rails, you can specify the version as part of the command, eg.
rails _4.2.2_ -v
That will tell you you are using Rails 4.2.
Once you've created a new app by doing something like rails _4.2.2_ new app_name, then the Gemfile for that app will specify Rails 4.2.2 and you can drop the special prefix.

How to downgrade my rails version?

I am using rails version 4.2.0. How can I downgrade to version 3.2.19?
I tried the following:
I opened command prompt.
I typed gem uninstall rails
Some options came for rails version then I selected my current version and pressed entered.
Then typed gem install rails -v 3.2.19 for installing this version.
I went to my Site directory and typed rails new blog
When I opened the Gemfile of blog application I found again Rails version 4.2.0 is present there.
Do:
gem uninstall rails
gem uninstall railties
Followed by:
gem install rails -v 3.2.19
To check a rails version, directly do:
rails -v
Another workaround:
add following to your Gemfile:
gem 'rails', '3.2.19'
and then run:
bundle install
Or you dont have to downgrade. You can always create a new rails app with a specific version(if that version is already installed)
rails _3.2.19_ new myApp
That is not good approach to uninstall a global version of Rails. So just create a Rails app:
rails new app
then change Rails version in its Gemfile, and issue bundle install:
cd app
sed "s/'rails', '~> 4.2.0'/'rails', '~> 3.2.19'/" -i Gemfile
bundle install
Then, I believe, you should change all the dependent packages to older versions.

Why it's so slow to use `rails new`?

The version is:
bash-3.2$ rails -v
Rails 3.2.9
And my ruby is the built-in ruby on MacOSX:
bash-3.2$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
bash-3.2$ which ruby
/usr/bin/ruby
My problem is that in the last step of rails new ( run bundle install), it seems that rails need to connect the internet to download some packages. And usually I need 5 minutes just wait for rails to create any project using rails new.
I was wondering whether somethings is not configured well for rails on my computer.
Another strange thing is that after I finished rails new PROJECT_NAME, it shows:
Using sqlite3 (1.3.6)
Using uglifier (1.3.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
It seems that sqlite3 has already been installed, however, when I try:
bash-3.2$ bundle show sqlite3
Could not locate Gemfile
It still complains that sqlite3is not installed. Maybe that's the reason that rails new is slow (Even sqlite3 has been installed once. It still needs to download the bundle)
Before bundle install, rails asks for my system password:
Enter your password to install the bundled RubyGems to your system
But I'm still not sure whether these packages have been installed into system, as bundle show sqlite3 failed.
Does anyone have ideas about why rails new is so slow on my computer? Thanks!
Another solution is to use RVM. It is similar to rbenv. I personally use RVM. I don't and would not recommend using the gemsets. Bundler does the separation of gem versions anyway.
Check what is up with your bundle install i.e. the last step in the rails new sequence. Run this instead:
rails new appname -B
The -B flag tells rails to "skip bundle" (reference). Then go into the app folder to run:
bundle install --verbose
Check for potential errors in the output.
Using different bundler versions can give you different results. So try other versions.
gem uninstall bundler -v your-version-number
gem install bundler -v new-version-number
In 2016, we got bundler v1.12.x which is causing some users to experience slow bundle install issues. In this case, using 1.11.2 is the faster option until they fix it.

Getting Rails and mod_passenger to work under Debian with packages

I am running a Debian squeeze server with these (backported) packages installed:
rails 2.3.5-1~bpo50+1
rails-ruby1.8 2.3.5-1~bpo50+1
rake 0.8.7-1~bpo50+1
libapache2-mod-passenger 2.2.11debian-1~bpo50+1
I have a Rails application I am trying to run in this environment, but when I load the page I get this error message:
Actual load error: Could not find
RubyGem rails (= 2.3.5) 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.
There is a constraint that I must use these "official" Rails and mod_passenger Debian packages, so installing Rails and mod_passenger the traditional way via gems is not a possibility.
There is no real reason that you should have to use offical gems from debian. You get faster security updates by using rubygems or going for fullblown rvm.
However I would suggest commenting out the RAILS_GEM_VERSION in config/environment.rb and then it should use the version you have installed.
This seems to work:
ln -s /usr/share/rails-ruby1.8/ /usr/share/myrailsproject/vendor/rails

Rails can't find my gems

I'm working on a newly configured computer, and can't seem to get rails to play nicely with my gems. Below are some of the errors I'm running into.
If I run 'script/console' in a rails project, I get the following error:
Missing the Rails gem. Please gem install -v= 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.
If I run 'rails -v' I get the following error:
/Library/Ruby/Site/1.8/rubygems.rb:777:in `report_activate_error': RubyGem version
error: activesupport(1.4.4 not = 2.3.4) (Gem::LoadError)
Both activesupport and rails gems are installed and updated, and are listed when I run 'gem list.' Any ideas? Thanks!
Is the location of the gems defined? (either in ~/.bash_profile or ~/.bashrc)
Something like:
export GEM_PATH=/Library/Ruby/Gems/1.8/:${GEM_PATH}
You'll want to see if you have gems on your home directory or off the root. You can do this by running gem environment.

Resources