简体   繁体   中英

RubyGem railties cannot be found after running “git push heroku master”

So here is my situation which is quiet strange. Using Aptana (Installed rails via rubyinstaller) I have my application pushed up into heroku stack cedar with the following GemFile:

source 'http://rubygems.org'
gem 'rails', '3.2.3'
#Added Web Design Framework
gem 'bootstrap-sass', '2.0.0'

group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.10.0'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails',   '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.0'
group :test do
gem 'capybara', '1.1.2'
end

group :production do
gem 'pg', '0.12.2'
end

I have tried changing the source from https to http however the point is that after this push and following error, rails is gone literally! rails -v command leads to the error that coud not load rubygem!Ruby is there but rails -v is not working anymore. Any help will be appreciated, folks!

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.0.pre
   Running: bundle install --without development:test --path vendor/bundle --binstubs bin/
   Fetching gem metadata from http://rubygems.org/........
   Bundler could not find compatible versions for gem "railties":
   In Gemfile:
   rails (= 3.2.3) ruby depends on
   railties (= 3.2.3) ruby
   jquery-rails (= 2.0.0) ruby depends on
   railties (3.2.4.rc1)

 !
 !     Failed to install gems via Bundler.
 !
 !     Heroku push rejected, failed to compile Ruby/rails app

Looks like it's basically a dependency conflict. jquery-rails needs a newer version of railties than the one rails requires.

To solve it (at least what I could do to solve it in a local test app), simply bump the required version of jquery-rails from 2.0.0 to 2.0.2. Alternatively, you could upgrade rails to 3.2.4 or .5, I suspect.

Generally speaking, gems should be required with ~> rather than = , ie

gem "jquery-rails", "~> 2.0.0"

rather than

gem "jquery-rails", "2.0.0"

This way Bundler can use gem versions 2.0.X rather than just 2.0.0, giving Bundler greater leeway finding a dependency tree that'll work out for the app. And it won't make your app dependencies more fragile, as the actual, working versions will be locked in Gemfile.lock and only updated when you want them to.

我会尝试再次部署,可能与rubygems的连接不好。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM