我是一个红宝石,ruby on rails和heroku greenhorn,它正试图从Michael Hartl's Ruby on Rails 3.2 tutorial学习编码。
现在在本章的最开始,我没有将所有内容部署到Heroku。我收到此错误消息(但我没有计划如何解决此问题):
$ git push heroku master
Counting objects: 69, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (54/54), done.
Writing objects: 100% (69/69), 27.34 KiB, done.
Total 69 (delta 5), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.0.rc
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/
Fetching gem metadata from https://rubygems.org/........
Bundler could not find compatible versions for gem "railties":
In Gemfile:
rails (= 3.2.6) ruby depends on
railties (= 3.2.6) ruby
jquery-rails (= 2.0.0) ruby depends on
railties (3.2.7.rc1)
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app
To git@heroku.com:pacific-anchorage-8098.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:pacific-anchorage-8098.git'
My Gemfile如下所示:
source 'https://rubygems.org'
gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
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'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
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
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
我希望有人可以帮助我(抱歉,我是初学者 - >也是在Stackoverflow,大声笑)。 KR,Fabian
答案 0 :(得分:3)
默认生成的Gemfile(使用rails 3.2.6)未指定要使用的jquery-rails版本。我建议做同样的事情,如下:
# remove version number, just like you would see in a fresh rails app
gem 'jquery-rails'
您需要的版本2.0.0依赖于栏目3.2.7.rc1 gem,您无法使用rails 3.2.6。
我在我的应用中使用了您的代码,无法将其捆绑到我的本地主机上。这让我想知道你是否在推到heroku之前自己尝试过。您应该始终首先在本地计算机上捆绑安装。
此外,您似乎已经碰到了sass-rails和coffee-rails所需的版本号。以下是您在干净的rails应用程序的Gemfile中所期望的:
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
答案 1 :(得分:1)
我现在可以自己解决问题了。就是这样:
gem 'rails', '3.2.6'
的部分更改为gem 'rails', '3.2.7rc1'
。bundle install --without production
git add .
git commit -a -m "Heroku recommit
git push
之类的github并按照用户名和密码的说明进行操作git push heroku master
答案 2 :(得分:0)
问题是jquery-rails gem需要一个不同版本的栏杆而不是捆绑文件中的rails gem。您可以尝试从jquery-rails中删除“2.0.0”,然后重试。 Bundle将安装一个版本的gem,它可用于版本3.2.6的铁路。