heroku推送拒绝,无法编译Ruby / rails应用程序

时间:2013-04-01 03:36:31

标签: ruby-on-rails heroku

有以下问题,BRR NEW TO TO RoR,第一次尝试上传应用程序上线,首先有托管问题,然后决定我是否可以使用heroku修复它们我只会使用带有heroku的自定义域名。 ....这不是一个测试应用程序“学习rails”的东西,我希望部署在我拥有的业务中使用的实际应用程序,任何帮助都会很棒,我已经搜索过并且没有看到解决此问题的方法。

确保'gem install sqlite3 -v 1.3.7'在捆绑之前成功。

Failed to install gems via Bundler

Heroku push rejected, failed to compile Ruby/rails app

To git@heroku.com:peaceful-chamber-6371.git
[remote rejected] master -> master <pre-receive hook declined>
error: failed to push some refs to 'git@heroku.com:peaceful-chamber-6371.git

宝石文件

source 'https://rubygems.org'

gem 'rails', '3.2.12'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3'
end
group :production do
  gem 'pg'
end


# 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'
  gem 'twitter-bootstrap-rails'
end

gem 'jquery-rails'

# 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'

6 个答案:

答案 0 :(得分:45)

试试这个,

删除Gemfile.lock文件并执行bundle install,然后git addgit commitgit push

答案 1 :(得分:4)

查看Heroku写入控制台的所有输出 - 您的错误很可能在某处。我碰到了这个,发现预编译步骤失败了。这也可以在本地运行:

rake assets:precompile

答案 2 :(得分:1)

虽然问题已经得到了答案,但答案对我没有帮助, 我有同样的问题。以下对我有用,因此有所贡献。 Heroku不支持sqlite 3.在这种情况下,我在我的gemfile中有sqlite3 gem,你应该将它放在开发组中,并将postgres gem(heroku支持)放在生产组中。

1)删除gemfile.lock文件(从项目文件夹中)

2)在gemfile中,删除gem sqlite3或类似的sqlite3 gem

3)而不是在文件末尾添加以下内容:

group :development, :test do
  gem 'sqlite3'
end
gem 'pg', group: :production`

现在,在终端中运行以下命令:

bundle install
git add .
git commit
git push
git push heroku master

虽然这是一个愚蠢的错误,但我花了很多时间才意识到这一点。希望它可以帮到某人。

答案 3 :(得分:0)

Heroku的资产插件不再有效,因为Rails 4不支持插件。你需要使用Heroku的资产宝石。将它放在你的Gemfile中:

group :production do
  gem 'rails_12factor'
end

在此处找到答案:Heroku does NOT compile files under assets pipelines in Rails 4为我工作

答案 4 :(得分:0)

我的问题是我在.gitignore中忽略了我的凉亭目录。

所以我要么需要从我的packages.json进行bower安装,要么检查我的凉亭目录。

http://xseignard.github.io/2013/02/18/use-bower-with-heroku/

我选择立即检查我的凉亭目录以获得快速解决方案。

答案 5 :(得分:0)

Heroku不喜欢sqlite3,用gem 'sqlite3'

更改gem 'pg'