18

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

在捆绑之前确保“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'
4

6 回答 6

46

试试这个,

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

于 2013-04-01T03:44:26.697 回答
4

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

rake assets:precompile
于 2013-10-10T11:41:25.900 回答
2

尽管该问题有一个公认的答案,但答案对我没有帮助,我遇到了同样的问题。以下内容对我有用,因此做出了贡献。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

尽管这是一个愚蠢的错误,但我花了一些时间才意识到这一点。希望它可以帮助某人。

于 2015-10-09T15:01:22.483 回答
1

Heroku 的资产插件不再工作,因为 Rails 4 不支持插件。您需要改用 Heroku 的资产宝石。把它放在你的 Gemfile 中:

group :production do
  gem 'rails_12factor'
end

在这里找到答案:Heroku 不编译 Rails 4 中资产管道下的文件为我工作

于 2013-10-22T11:56:40.037 回答
0

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

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

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

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

于 2014-07-14T17:38:16.340 回答
0

Heroku 不喜欢 sqlite3,gem 'sqlite3'改用gem 'pg'

于 2016-03-21T17:50:43.570 回答