Ruby gem(Ruby on Rails)出错

时间:2017-01-30 12:24:13

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4 rubygems

我的gemfile仍然出错,我可以下载所有宝石,但是在'rails server'的那一刻我收到了这个错误:

/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'will_paginate'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant ActiveSupport::LogSubscriber
Backtrace for gem load error is:
/home/administrador/.rvm/gems/ruby-2.4.0/gems/activerecord-3.0.5/lib/active_record/log_subscriber.rb:2:in `<module:ActiveRecord>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/activerecord-3.0.5/lib/active_record/log_subscriber.rb:1:in `<top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/activerecord-3.0.5/lib/active_record/base.rb:24:in `<top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/will_paginate-2.3.15/lib/will_paginate.rb:33:in `require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/will_paginate-2.3.15/lib/will_paginate.rb:33:in `enable_activerecord'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/will_paginate-2.3.15/lib/will_paginate.rb:88:in `<top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `each'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `block in require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `each'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler.rb:106:in `require'
/home/administrador/Documents/forminst4/config/application.rb:7:in `<top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:28:in `require'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:28:in `block in <top (required)>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:27:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Bundler Error Backtrace:
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `each'
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:86:in `block in require'
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `each'
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:75:in `require'
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler.rb:106:in `require'
    from /home/administrador/Documents/forminst4/config/application.rb:7:in `<top (required)>'
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:28:in `require'
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:28:in `block in <top (required)>'
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap'
    from /home/administrador/.rvm/gems/ruby-2.4.0/gems/railties-3.0.5/lib/rails/commands.rb:27:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

这是我的宝石文件:

source 'http://rubygems.org'

gem 'rails', '3.0.5'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2', '~> 0.2.6'
gem 'prawn', '0.8.4'
gem 'jquery-rails'
gem 'carrierwave'
gem 'will_paginate', '2.3.15'
gem 'net-ldap', '0.3.1'
gem 'cancan', '1.6.10'
gem 'therubyracer'

如果你能帮助我,我将非常感激!非常感谢

编辑:我已经尝试将“gem'will_paginate','〜&gt; 3.1.0'”添加到我的gemfile中..当我运行rails服务器时,我收到此错误

/home/administrador/.rvm/gems/ruby-2.4.0/gems/bundler-1.13.7/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'cancan'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant AbstractController::ViewPaths
Backtrace for gem load error is:
/home/administrador/.rvm/gems/ruby-2.4.0/gems/actionpack-3.0.5/lib/abstract_controller/rendering.rb:36:in `<module:Rendering>'
/home/administrador/.rvm/gems/ruby-2.4.0/gems/actionpack-3.0.5/lib/abstract_controller/rendering.rb:33:in `<module:AbstractController>'....(same as above)

1 个答案:

答案 0 :(得分:0)

只需用

更新你的gemfile
gem 'will_paginate', '~> 3.1.0'

rails 3或3+版本需要以上版本才能进行分页

参考此https://github.com/mislav/will_paginate