appfog上的rails应用程序中的Gemfile依赖项问题

时间:2014-02-01 15:53:44

标签: ruby-on-rails ruby rubygems gem appfog

我在RoR中编写了一个应用程序,然后我尝试在appfog上部署它。 我创建了应用程序,但推后我得到了这个错误:

Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (2M): OK
Push Status: OK
Stopping Application 'otj': OK

Staging Application 'otj': OK
Starting Application 'otj': ..
Error: Application [otj] failed to start, logs information below.
====> /logs/migration.log <====

/var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app/rubygems/rub
y/1.8/gems/bundler-1.1.3/lib/bundler/resolver.rb:129:in `resolve': Bundler could
 not find compatible versions for gem "bundler": (Bundler::VersionConflict)
  In Gemfile:
    rails (= 4.0.0) ruby depends on
      bundler (< 2.0, >= 1.3.0) ruby

  Current Bundler version:
    bundler (1.1.3)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler/resolver.rb:127:in `catch'
        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler/resolver.rb:127:in `resolve'
        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb:192:in `resolve'

        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb:127:in `specs'
        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb:172:in `specs_fo
r'
        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler/definition.rb:161:in `requeste
d_specs'
        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler/environment.rb:23:in `requeste
d_specs'
        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:11:in `setup'
        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler.rb:107:in `setup'
        from /var/vcap.local/dea/apps/otj-0-93de4f274c73b17a027e6b04e23a0723/app
/rubygems/ruby/1.8/gems/bundler-1.1.3/lib/bundler/setup.rb:17

====> /logs/staging.log <====

# Logfile created on 2014-02-01 15:33:19 +0000 by logger.rb/25413
Adding coffee-script-source-1.7.0.gem to app...
Adding execjs-2.0.2.gem to app...
Adding coffee-script-2.2.0.gem to app...

[Adding other gems]

Adding json-1.8.1.gem to app...
Adding uglifier-2.4.0.gem to app...
Adding bundler-1.1.3.gem to app...
Adding cf-autoconfig-0.0.4.gem to app...
Adding cf-runtime-0.0.2.gem to app...
Running rake assets:precompile
Assets precompilation failed: /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/rub
y/gems/1.8/gems/bundler-1.1.3/lib/bundler/resolver.rb:129:in `resolve': Bundler
could not find compatible versions for gem "bundler": (Bundler::VersionConflict)

  In Gemfile:
    rails (= 4.0.0) ruby depends on
      bundler (< 2.0, >= 1.3.0) ruby

  Current Bundler version:
    bundler (1.1.3)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler/resolver.rb:127:in `catch'
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler/resolver.rb:127:in `resolve'
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler/definition.rb:192:in `resolve'
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler/definition.rb:127:in `specs'
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler/definition.rb:172:in `specs_for'
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler/definition.rb:161:in `requested_specs'
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler/environment.rb:23:in `requested_specs'
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler/runtime.rb:11:in `setup'
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler.rb:107:in `setup'
        from /opt/cloudfoundry/runtimes/ruby-1.8.7-p334/lib/ruby/gems/1.8/gems/b
undler-1.1.3/lib/bundler/setup.rb:17

Turning on live assets compilation

我的Gemfile:

source 'https://rubygems.org'
source 'https://rails-assets.org'

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

gem 'pg'

gem 'sass-rails', '>= 4.0.0'

gem 'uglifier', '>= 1.3.0'

gem 'coffee-rails', '>= 4.0.0'

gem 'jquery-rails'

gem 'turbolinks'

gem 'jbuilder', '>= 1.2'

gem "rails-assets", ">= 0.5.2"
gem 'rails-assets-bootstrap'
gem 'cancan'
gem 'activeadmin', :github => 'gregbell/active_admin'


group :production do
  gem 'mysql'
end

我的生产配置:

OTD::Application.configure do

  config.cache_classes = true

  config.eager_load = true

  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  config.serve_static_assets = true

  config.assets.js_compressor = :uglifier

  config.assets.compile = false

  config.assets.digest = true

  config.assets.version = '1.0'

  config.log_level = :info

  config.i18n.fallbacks = true

  config.active_support.deprecation = :notify

  config.log_formatter = ::Logger::Formatter.new
end

是否所有关于服务器上的bundler版本?

你能帮助我吗?我是Ror的新人。 Localy一切正常。我试图将'bundler'作为gem的旧版本添加到gemfile中,但它没有帮助。

-----编辑-----

使用--runtime ruby​​193推送应用程序后的

日志:

Starting Application 'otj': ..
Error: Application [otj] failed to start, logs information below.
====> /logs/migration.log <====

/var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app/rubygems/rub
y/1.9.1/gems/bundler-1.1.3/lib/bundler/resolver.rb:129:in `block in resolve': Bu
ndler could not find compatible versions for gem "bundler": (Bundler::VersionCon
flict)
  In Gemfile:
    rails (= 4.0.0) ruby depends on
      bundler (< 2.0, >= 1.3.0) ruby

  Current Bundler version:
    bundler (1.1.3)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/resolver.rb:127:in `catch'
        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/resolver.rb:127:in `resolve'

        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:192:in `resolv
e'
        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:127:in `specs'

        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:172:in `specs_
for'
        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/definition.rb:161:in `reques
ted_specs'
        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/environment.rb:23:in `reques
ted_specs'
        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/runtime.rb:11:in `setup'
        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler.rb:107:in `setup'
        from /var/vcap.local/dea/apps/otj-0-8ce72d0af7bc6b832f55fbaf5d913528/app
/rubygems/ruby/1.9.1/gems/bundler-1.1.3/lib/bundler/setup.rb:17:in `<top (requir
ed)>'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1
/rubygems/custom_require.rb:36:in `require'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1
/rubygems/custom_require.rb:36:in `require'

====> /logs/staging.log <====

# Logfile created on 2014-02-01 18:00:53 +0000 by logger.rb/25413
Adding coffee-script-source-1.7.0.gem to app...
Adding execjs-2.0.2.gem to app...
Adding coffee-script-2.2.0.gem to app...

[oher gems]

Adding json-1.8.1.gem to app...
Adding uglifier-2.4.0.gem to app...
Adding bundler-1.1.3.gem to app...
Adding cf-autoconfig-0.0.4.gem to app...
Adding cf-runtime-0.0.2.gem to app...
Running rake assets:precompile
Assets precompilation failed: /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/rub
y/gems/1.9.1/gems/bundler-1.1.3/lib/bundler/resolver.rb:129:in `block in resolve
': Bundler could not find compatible versions for gem "bundler": (Bundler::Versi
onConflict)
  In Gemfile:
    rails (= 4.0.0) ruby depends on
      bundler (< 2.0, >= 1.3.0) ruby

  Current Bundler version:
    bundler (1.1.3)

This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler/resolver.rb:127:in `catch'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler/resolver.rb:127:in `resolve'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler/definition.rb:192:in `resolve'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler/definition.rb:127:in `specs'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler/definition.rb:172:in `specs_for'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler/definition.rb:161:in `requested_specs'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler/environment.rb:23:in `requested_specs'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler/runtime.rb:11:in `setup'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler.rb:107:in `setup'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/gems/1.9.1/gems
/bundler-1.1.3/lib/bundler/setup.rb:17:in `<top (required)>'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1
/rubygems/custom_require.rb:36:in `require'
        from /opt/cloudfoundry/runtimes/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1
/rubygems/custom_require.rb:36:in `require'

Turning on live assets compilation

1 个答案:

答案 0 :(得分:1)

问题是Appfog试图在ruby 1.8中运行你的应用程序,因为它是默认的 正如您在https://docs.appfog.com/languages/ruby

上看到的那样

正如文档所述,您需要为ruby 1.9.3提供参数--runtime ruby193

因此,当您推送应用时,您需要像

那样进行操作
af push <appname> --runtime ruby193

更新

坏消息,appfog仍然不支持rails 4.正如你在这篇文章中看到的,其他人也有同样的问题。

http://feedback.appfog.com/forums/171983-appfog/suggestions/3954090-please-update-bundler

Appfog有捆绑版本1.1.3,rails4需要1.3.0

解决方案:降级到rails 3.2或选择其他提供商:/它很难过,但这就是生活。