0

Before this question gets closed as duplicate let me first say that I have tried multiple solutions presented in questions of similar nature. I am working through the Ruby on Rails 4.0 Tutorial and I have gotten as far as pushing my code to Heroku. However, whenever I run the following:

$ git push heroku master

I get the following:

Counting objects: 74, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (63/63), done.
Writing objects: 100% (74/74), 15.59 KiB, done.
Total 74 (delta 11), reused 0 (delta 0)

-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> 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
   Bundler Output: /usr/bin/env: ruby1.9.1: No such file or directory
   !
   !     Failed to install gems via Bundler.
   !

   !     Push rejected, failed to compile Ruby/Rails app

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

I have tried several things including changing my Gemfile (see below)

Gemfile :

source 'https://rubygems.org'

ruby '2.0.0'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use sqlite3 as the database for Active Record
group :development do
gem 'sqlite3'
end

# Use SCSS for stylesheets
gem 'sass-rails', '4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.1.1'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails', '2.2.1'

# Turbolinks makes following links in your web application faster. Read more:     https://github.com/rails/turbolinks
gem 'turbolinks', '1.1.1'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'

group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '0.3.20', require: false
end

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

gem 'rails_12factor', group: :production

and editing the configuration variables

$ heroku config:set GEM_PATH = vendor/bundle/ruby/1.9.1
$ heroku config:set PATH = bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin

I have also tried running bundle from Heroku using

$ heroku run "bundle update"

However I get this error

bash: bundle: command not found

I have also checked my logs but those are only good for post deployment problems.

Does anyone know how to fix this problem?

Perhaps there is a missing file or directory on the Heroku side of things.

4

1 回答 1

3

看来,为了解决这个问题,您需要关闭 Bundler 的存根生成器,因为 Rails 4 应用程序不会将存根存储在应用程序的 bin/ 目录中。为此,请使用以下命令:

$ bundle config --delete bin

然后您需要更新 bin 目录以使用新的 Rails 4 可执行文件

$ rake rails:update:bin

然后使用以下命令将新的 bin/ 目录添加到您的版本控制中:

$ git add bin

提交更改并将您的代码推送到 Heroku

于 2013-07-05T21:31:57.777 回答