2

我尝试在 rails 应用程序上部署 ruby​​。我收到了这个错误

/usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:31:in `block in setup': You have already activated rack 1.5.1, but your Gemfile requires rack 1.4.4. Using bundle exec may solve this. (Gem::LoadError)
        from /usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:17:in `setup'
        from /usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.2.0/lib/bundler.rb:116:in `setup'
        from /usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.2.0/lib/bundler/setup.rb:7:in `<top (required)>'
        from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /var/www/rails/mgm/config/boot.rb:6:in `<top (required)>'
        from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /var/www/rails/mgm/config/application.rb:1:in `<top (required)>'
        from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /var/www/rails/mgm/config/environment.rb:2:in `<top (required)>'
        from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /var/www/rails/mgm/config.ru:3:in `block in <main>'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/rack-1.5.1/lib/rack/builder.rb:55:in `instance_eval'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/rack-1.5.1/lib/rack/builder.rb:55:in `initialize'
        from /var/www/rails/mgm/config.ru:1:in `new'
        from /var/www/rails/mgm/config.ru:1:in `<main>'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/thin-1.5.0/lib/rack/adapter/loader.rb:33:in `eval'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/thin-1.5.0/lib/rack/adapter/loader.rb:33:in `load'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/thin-1.5.0/lib/rack/adapter/loader.rb:42:in `for'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/thin-1.5.0/lib/thin/controllers/controller.rb:169:in `load_adapter'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/thin-1.5.0/lib/thin/controllers/controller.rb:73:in `start'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/thin-1.5.0/lib/thin/runner.rb:187:in `run_command'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/thin-1.5.0/lib/thin/runner.rb:152:in `run!'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/thin-1.5.0/bin/thin:6:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/bin/thin:19:in `load'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/bin/thin:19:in `<main>'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/bin/ruby_noexec_wrapper:14:in `eval'
        from /usr/local/rvm/gems/ruby-1.9.3-p125/bin/ruby_noexec_wrapper:14:in `<main>'

我添加到 Gemfile

 gem 'rack' '1.5.1'

跑了

bundle update rack

我收到以下错误

Bundler could not find compatible versions for gem "rack":
  In Gemfile:
    rails (= 3.2.8) ruby depends on
      rack (~> 1.4.0) ruby

    rack (1.5.1)

我跑了

 bundle exec

返回

bundler: exec needs a command to run
4

2 回答 2

6

尝试卸载机架

gem uninstall rack 

并运行

bundle install
于 2013-01-31T05:52:21.900 回答
0

您可以使用此命令:

bundle update
于 2015-02-21T08:11:58.527 回答