簡體   English   中英

推到Heroku時Bundler Rails 4.0應用程序錯誤

[英]Bundler Rails 4.0 App Error When Pushing to Heroku

在這個問題作為重復問題解決之前,我首先要說我已經嘗試過針對相似性質問題提出的多種解決方案。 我正在研究Ruby on Rails 4.0教程,並且已經將我的代碼推送到Heroku了。 但是,無論何時運行以下命令:

$ git push heroku master

我得到以下內容:

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'

我嘗試了幾件事,包括更改了我的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

和編輯配置變量

$ 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

我也嘗試過使用Heroku從運行捆綁

$ heroku run "bundle update"

但是我得到這個錯誤

bash: bundle: command not found

我還檢查了我的日志,但是這些日志僅對部署后的問題有用。

有誰知道如何解決這個問題?

也許東西的Heroku端缺少文件或目錄。

看來,為了解決此問題,您需要關閉Bundler的存根生成器,因為Rails 4應用程序不會在應用程序的bin /目錄中存儲存根。 為此,請使用以下命令:

$ bundle config --delete bin

然后,您需要更新bin目錄以使用新的Rails 4可執行文件

$ rake rails:update:bin

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

$ git add bin

提交更改並將代碼推送到Heroku

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM