简体   繁体   English

为什么我的Heroku推送被拒绝?

[英]Why is my Heroku push rejected?

I am working through chapter 1 of Hartl's Rails 4.0 tutorial , and I'm stuck on Section 1.4.2, which is to push a black app into GitHub and Heroku. 我正在学习Hartl的Rails 4.0教程的第1章,而我停留在1.4.2节中,这是将黑色应用程序推送到GitHub和Heroku中。

I tried typing git push heroku master , but I get an error message, similar to a previous question on StackOverFlow: 我尝试输入git push heroku master ,但收到错误消息,类似于StackOverFlow上的先前问题:

It's probably the same but I don't even realize it: 可能是一样的,但我什至没有意识到:

-----> Ruby/Rails app detected
-----> Installing dependencies using 
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
       /usr/bin/env: ruby1.9.1: No such file or directory
 !
 !     Failed to install gems via Bundler.
 !
 !     Heroku push rejected, failed to compile Ruby/Rails app

Here is the Gemfile I used: 这是我使用的Gemfile:

source 'https://rubygems.org'
ruby '1.9.3'

gem 'rails', '4.0.0.rc1'

group :development do
  gem 'sqlite3', '1.3.7'
end

gem 'sass-rails', '4.0.0.rc1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.0'
gem 'jquery-rails', '2.2.1'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'

group :doc do
  gem 'sdoc', '0.3.20', require: false
end

group :production do
  gem 'pg', '0.15.1'
end

UPDATE : The main error seems to be /usr/bin/env: ruby1.9.1: No such file or directory Is that folder on the Heroku machine or my home computer ? 更新 :主要错误似乎是/usr/bin/env: ruby1.9.1: No such file or directory Heroku机器或我的家用计算机上的那个文件夹?

I tried removing the line ruby '1.9.3' from my .gitignore but it still returns this message. 我尝试从.gitignore删除行ruby '1.9.3' ,但仍返回此消息。

First, Remove ruby 1.9.3 from the Gemfile . 首先,从Gemfile删除ruby 1.9.3 You don't need it and may be the cause of your problem. 您不需要它,可能是造成问题的原因。 Start of your Gemfile should look like this: Gemfile开始应如下所示:

source 'https://rubygems.org'

gem 'rails', '4.0.0.rc1'

group :development do
  gem 'sqlite3', '1.3.7'
end

etc........

Also, make sure you run 另外,请确保您运行

bundle install --without production 

since you are using sqlite3 in :development and postgresql in :production 因为您在:development中使用sqlite3而在:production中使用postgresql

I had a similar problem. 我有一个类似的问题。 The issue is that Bundler is generating stubs. 问题是Bundler正在生成存根。 Rails 4 apps do not store stubs in the app's bin/ directory. Rails 4应用程序不在应用程序的bin /目录中存储存根。 In order to fix this problem you need to use the following commands: 为了解决此问题,您需要使用以下命令:

$ bundle config --delete bin

Then you need to update the bin directory to use the new Rails 4 executables 然后,您需要更新bin目录以使用新的Rails 4可执行文件

$ rake rails:update:bin

Then add the new bin/ directory to your version control using: 然后使用以下命令将新的bin /目录添加到您的版本控制中:

$ git add bin

Commit the changes and push your code to Heroku 提交更改并将代码推送到Heroku

i had the same problem and the problem was that i didn't chose the version of ruby that i want to use, so i did the following: 我有同样的问题,问题是我没有选择要使用的红宝石版本,所以我做了以下工作:

$rvm list
   ruby-1.9.3-p392 [ i686 ]
   ruby-2.0.0-p247 [ i686 ]

$rvm use  ruby-1.9.3-p392

$rvm list 
    =>   ruby-1.9.3-p392 [ i686 ]
    ruby-2.0.0-p247 [ i686 ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM