1

捆绑安装工作。但是当我 git push heroku master 时,我得到了这个:

C:\Sites\first_app>git push heroku master
Warning: Permanently added the RSA host key for IP address '50.19.85.132' t
list of known hosts.
Counting objects: 65, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (51/51), done.
Writing objects: 100% (65/65), 26.10 KiB, done.
Total 65 (delta 3), reused 0 (delta 0)

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

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

To git@heroku.com:evening-frost-9408.git
[remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:evening-frost-9408.git'

这是我的宝石文件:

source 'https://rubygems.org'

gem 'rails', '3.2.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

group :development do
  gem 'sqlite3', '1.3.5'
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'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

我基本上遵循 Ruby on Rails 教程。但是我的rails是3.2.1,但是网上书上说的是rails 3.2.3。我尝试将其更改为 3.2.3 和 ~>3.2.3,我仍然收到相同的错误消息

谢谢

4

2 回答 2

3

我遇到了同样的问题,尝试在 heroku 上部署时无法运行“捆绑安装”和同样的问题(我正在遵循相同的教程)。

在这里找到了一个很好的答案:rubygems.org 不提供 HTTPS,因此将 gemfile 的标头从 更改https://rubygems.orghttp://rubygems.org

于 2012-05-14T16:31:14.910 回答
0

我有一个类似的问题,并想我会添加我的解决方案。

最初我的主要项目被分离成包含在主要项目中的宝石。随着 gems 和项目之间的耦合增加,将 gems 的代码直接引入主 rails 项目的 /lib 是有意义的。在合并期间,.gitignore 文件被合并,没有任何冲突。不幸的是,gem 的 .gitignore 与独立项目的 .gitignore 非常不同。当我继续进行时,当我在本地更新一个 gem 时,它会在远程推送部署到 Heroku 时失败。事实证明,gem 中的 .gitignore 有类似Gemfile.lock的东西*.gem

TLDR;确保你的 .gitignore 文件是健全的

于 2013-04-02T22:25:09.573 回答