加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Rails – 使用thin时的bundler错误

发布时间:2020-12-17 03:34:13 所属栏目:百科 来源:网络整理
导读:我开始使用bundler并且在使用它时遇到一些问题.我有以下gemfile: source "http://rubygems.org"gem "rack","~1.1"gem 'pg','= 0.8.0'gem 'rails','2.3.8'gem 'authlogic','2.1.3'gem 'ajaxful_rating','2.2.3'gem 'will_paginate','2.3.12'gem 'right_aws',
我开始使用bundler并且在使用它时遇到一些问题.我有以下gemfile:

source "http://rubygems.org"
gem "rack","~>1.1"
gem 'pg','>= 0.8.0'
gem 'rails','2.3.8'
gem 'authlogic','2.1.3'
gem 'ajaxful_rating','2.2.3'
gem 'will_paginate','2.3.12'
gem 'right_aws','1.10.0'
gem 'aws-s3','0.6.2'
gem 'declarative_authorization','0.4.1'
gem 'timeline_fu','0.3.0'
gem 'friendly_id','>= 3.1'

请注意,我具体说我想使用rack 1.1(1.1.0).

我运行瘦时遇到以下错误(Webrick工作正常):

thin start
>> Using rails adapter
/usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/runtime.rb:27:in `setup': You have already activated rack 1.2.1,but your Gemfile requires rack 1.1.0. Consider using bundle exec. (Gem::LoadError)
 from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in `each'
 from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/spec_set.rb:12:in `each'
 from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler/runtime.rb:17:in `setup'
 from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.3/lib/bundler.rb:100:in `setup'
 from /home/vmplanet/Documents/maga/config/../config/preinitializer.rb:16
 from /home/vmplanet/Documents/maga/config/boot.rb:28:in `load'
 from /home/vmplanet/Documents/maga/config/boot.rb:28:in `preinitialize'
 from /home/vmplanet/Documents/maga/config/boot.rb:10:in `boot!'
 from /home/vmplanet/Documents/maga/config/boot.rb:126
 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
 from /home/vmplanet/Documents/maga/config/environment.rb:7
 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
 from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/rack/adapter/rails.rb:42:in `load_application'
 from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/rack/adapter/rails.rb:23:in `initialize'
 from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/rack/adapter/loader.rb:48:in `new'
 from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/rack/adapter/loader.rb:48:in `for'
 from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/controllers/controller.rb:163:in `load_adapter'
 from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/controllers/controller.rb:67:in `start'
 from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/runner.rb:177:in `send'
 from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
 from /home/vmplanet/.gem/ruby/1.8/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'

所以基本上它抱怨我使用机架1.2.1(事实并非如此,我想不出任何使用它的东西).

有什么想法吗?

解决方法

在机架上轻薄 depends.并且因为Thin会在加载应用程序之前加载自身,所以当捆绑器首次进入图片时,最新版本的Rack将被加载.

您必须强制使用正确版本的Rack to Thin.从理论上讲,你的系统宝石只能使用Rack 1.1.0,但这很难维护或移植.错误消息已包含答案;使用bundle exec.

bundle exec thin start

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读