2013-02-18 143 views
0

我試圖讓一箇舊的Heroku應用程序運行,失敗迄今。 $ heroku stack返回Git推送Heroku引發Bundler錯誤

=== <app_name> Available Stacks 
    bamboo-ree-1.8.7 
    cedar 
* bamboo-mri-1.9.2 (prepared, will migrate on next git push) 

,推動的時候,我得到如下:

$ git push heroku master 
Counting objects: 48, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (31/31), done. 
Writing objects: 100% (31/31), 4.00 KiB, done. 
Total 31 (delta 18), reused 0 (delta 0) 
-----> Ruby/Rails app detected 
-----> Detected Rails is not set to serve static_assets 
     Installing rails3_serve_static_assets... done 
-----> Configure Rails 3 to disable x-sendfile 
     Installing rails3_disable_x_sendfile... done 
-----> Configure Rails to log to stdout 
     Installing rails_log_stdout... done 
-----> Gemfile detected, running Bundler version 1.0.7 
     Unresolved dependencies detected; Installing... 
     /tmp/build_3cljt2m8e8r7e/Gemfile:2:in `evaluate': undefined method `ruby' for #<Bundler::Dsl:0x00000003221778> (NoMethodError) 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/dsl.rb:7:in `instance_eval' 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/dsl.rb:7:in `evaluate' 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/definition.rb:17:in `build' 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler.rb:128:in `definition' 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install' 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run' 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch' 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start' 
     from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/bin/bundle:13:in `<top (required)>' 
     from /usr/ruby1.9.2/bin/bundle:19:in `load' 
     from /usr/ruby1.9.2/bin/bundle:19:in `<main>' 
     FAILED: http://devcenter.heroku.com/articles/bundler 
!  Heroku push rejected, failed to install gems via Bundler 

To [email protected]:<app_name>.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:<app_name>.git' 

當前的Gemfile:

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

gem 'bundler', '1.3.0.pre.8' 
gem 'rails', '~> 3.2' 
gem 'jquery-rails', '~> 2.2' 
gem 'slim', '~> 1.3' 
gem 'dynamic_form', '~> 1.0' 
gem 'state_machine', '~> 1.1' 
gem 'draper', '~> 1.1' 
gem 'bcrypt-ruby', '~> 3.0', :require => 'bcrypt' 
gem 'thin', '~> 1.5' 
gem 'twitter-bootstrap-rails', '~> 2.2' 

group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'less-rails', '~> 2.2' 
    gem 'coffee-rails', '~> 3.2.1' 
    gem 'therubyracer', '~> 0.11', :platforms => :ruby 
    gem 'uglifier', '>= 1.0.3' 
end 

group :development do 
    gem 'sqlite3', '~> 1.3' 
    gem 'pry', '~> 0.9' 
    gem 'better_errors', '~> 0.3' 
    gem 'binding_of_caller', '~> 0.6' 
end 

group :production do 
    gem 'pg', '~> 0.14' 
end 

似乎有一個問題與捆紮機,任何想法?

+0

https://devcenter.heroku.com/articles/ruby-versions – gabrielhilal 2013-02-18 15:14:05

+0

也https://blog.heroku.com/archives/2012/5/9/multiple_ruby_version_support_on_heroku/ – gabrielhilal 2013-02-18 15:17:03

回答

2

問題是由Gemfile中的2號線造成的:

ruby '1.9.3' 

從輸出我們可以看到捆紮機運行的版本:

Gemfile detected, running Bundler version 1.0.7 

ruby指令似乎捆紮機1.2功能並不會與舊Bundler一起工作。我認爲你現在可以安全地刪除這個ruby '1.9.3'行。


當然,你有你的gemfile中的gem 'bundler', '1.3.0.pre.8'。但是這是雞與雞蛋的問題:在分析Gemfile之前不會安裝新的Bundler,但舊的Bundler無法解析它。

+0

哦,對。現在刪除了「紅寶石1.9.3」聲明並推送作品。現在又犯了一個錯誤,但那是另一個錯誤。謝謝! – tbuehlmann 2013-02-18 15:35:54

+0

那麼解決這個問題的實際方法是什麼?我不認爲刪除你的ruby版本規範是很好的做法。 – light24bulbs 2014-08-16 19:42:24