heroku 推送被拒绝,无法编译 Ruby/rails 应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15737296/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
heroku push rejected, failed to compile Ruby/rails app
提问by Jeff Gray
Having the following issue, BRAND NEW TO RoR, first time ever trying to upload an app to go live, first had hosting issues, then decided if i could fix them with heroku i would just use a custom domain with heroku...... No this isnt a test app "learning rails" thing, actual app i want to deploy for use within the business I own, any help would be great, I have searched and havent seen a solution to this problem.
遇到以下问题,全新的 RoR,第一次尝试上传应用程序上线,首先遇到托管问题,然后决定是否可以使用 heroku 修复它们,我将只使用带有 heroku 的自定义域..... . 不,这不是一个测试应用程序“学习轨道”的东西,我想部署在我拥有的业务中使用的实际应用程序,任何帮助都会很棒,我已经搜索过但还没有看到这个问题的解决方案。
Make sure 'gem install sqlite3 -v 1.3.7' succeeds before bundling.
在捆绑之前确保“gem install sqlite3 -v 1.3.7”成功。
Failed to install gems via Bundler
Heroku push rejected, failed to compile Ruby/rails app
To [email protected]:peaceful-chamber-6371.git
[remote rejected] master -> master <pre-receive hook declined>
error: failed to push some refs to '[email protected]:peaceful-chamber-6371.git
Gem File
宝石文件
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'
回答by Vamsi Krishna B
try this,
尝试这个,
remove Gemfile.lockfile and do bundle install, then git add, git commitand git push.
删除Gemfile.lock文件并执行bundle install,然后git add,git commit和git push。
回答by Ultrasaurus
Look though the all of the output that Heroku writes to the console -- your error is likely to be there somewhere. I ran into this and found that the precompile step had failed. That can be run locally as well:
看看 Heroku 写到控制台的所有输出——你的错误很可能在某个地方。我遇到了这个,发现预编译步骤失败了。也可以在本地运行:
rake assets:precompile
回答by Piyush Mahensaria
Although the question has an accepted answer, the answer did not help me, I had the same problem. The following worked for me, hence contributing. Heroku does not support sqlite 3. In this case, I had sqlite3 gem in my gemfile, which you are supposed to put in development group, and put postgres gem (which heroku supports) in production group.
虽然这个问题有一个公认的答案,但答案对我没有帮助,我遇到了同样的问题。以下对我有用,因此有所贡献。Heroku 不支持 sqlite 3。在这种情况下,我的 gemfile 中有 sqlite3 gem,您应该将其放入开发组,并将 postgres gem(heroku 支持)放入生产组。
1) Delete the gemfile.lock file (from your project folder)
1) 删除 gemfile.lock 文件(从你的项目文件夹中)
2) In the gemfile, remove gem sqlite3or similar sqlite3 gem
2)在gemfile中,删除gem sqlite3或类似sqlite3 gem
3) Instead of that add following to the end of file:
3)而不是在文件末尾添加以下内容:
group :development, :test do
gem 'sqlite3'
end
gem 'pg', group: :production`
Now, run the following commands in terminal:
现在,在终端中运行以下命令:
bundle install
git add .
git commit
git push
git push heroku master
Although it was a silly mistake, It took me time to realize the same. Hope it helps someone.
虽然这是一个愚蠢的错误,但我花了很长时间才意识到这一点。希望它可以帮助某人。
回答by Renan
Heroku does not like sqlite3, change gem 'sqlite3'with gem 'pg'
Heroku 不喜欢 sqlite3,换gem 'sqlite3'用gem 'pg'
回答by Connor Leech
Heroku's asset plugins no longer work since Rails 4 does not support plugins. You need to use Heroku's asset gems instead. Place this in your Gemfile:
Heroku 的资产插件不再工作,因为 Rails 4 不支持插件。您需要改用 Heroku 的资产宝石。把它放在你的 Gemfile 中:
group :production do
gem 'rails_12factor'
end
Answer found here: Heroku does NOT compile files under assets pipelines in Rails 4worked for me
答案在这里找到:Heroku 不编译 Rails 4 中的资产管道下的文件对我来说有效
回答by Ben Johnson
My issue was that I had my bower directory ignored in .gitignore.
我的问题是我在 .gitignore 中忽略了我的凉亭目录。
So I either need to do bower install from my packages.json or check in my bower dir.
所以我要么需要从我的 packages.json 中安装 bower,要么检查我的 bower 目录。
http://xseignard.github.io/2013/02/18/use-bower-with-heroku/
http://xseignard.github.io/2013/02/18/use-bower-with-heroku/
I chose to check in my bower dir for a quick solution right now.
我现在选择检查我的凉亭目录以获得快速解决方案。

