small medium large xlarge

Generic-user-small
12 Jul 2017, 16:05
Dong.Xu (5 posts)

Environment: Rails 5.1.2 + Ruby 2.4.1 + rbenv


“Using devise 1.5.4”, I grep it from outputs of bundle install


After added gem "devise" to Gemfile and run bundle install, I ran bundle exec generate devise:install

And I got an error.


OUTPUT:

/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:85:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'devise'. (Bundler::GemRequireError)
Gem Load Error is: undefined method `alias_method_chain' for ActionDispatch::Routing::RouteSet:Class
Did you mean?  alias_method
Backtrace for gem load error is:
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:14:in `<class:RouteSet>'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:2:in `<module:Routing>'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:1:in `<top (required)>'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `block in require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise-1.5.4/lib/devise/rails.rb:1:in `<top (required)>'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `block in require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.2/lib/active_support/dependencies.rb:292:in `require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/devise-1.5.4/lib/devise.rb:445:in `<top (required)>'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:82:in `block (2 levels) in require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `each'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `block in require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `each'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler.rb:108:in `require'
/Users/dongxu/workspace/rails/shine/config/application.rb:17:in `<top (required)>'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/actions.rb:15:in `require'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/generate/generate_command.rb:19:in `perform'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/base.rb:63:in `perform'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command.rb:44:in `invoke'
/Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Bundler Error Backtrace:
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `each'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:77:in `block in require'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `each'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler/runtime.rb:66:in `require'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.1/lib/bundler.rb:108:in `require'
        from /Users/dongxu/workspace/rails/shine/config/application.rb:17:in `<top (required)>'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/actions.rb:15:in `require'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/generate/generate_command.rb:19:in `perform'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command/base.rb:63:in `perform'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command.rb:44:in `invoke'
        from /Users/dongxu/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands.rb:16:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
Dmfcb_pragsmall
13 Jul 2017, 13:00
David Copeland (423 posts)

You shoud be using devise 4.3.0, which is compatible with Rails 5.1.2: https://github.com/plataformatec/devise/blob/master/devise.gemspec#L24

Can you post your Gemfile.lock?

Also, try doing a bundle update and see if that updates it?

Generic-user-small
13 Jul 2017, 14:39
Dong.Xu (5 posts)

Thank you, the problem was solved by add the devise to Gemfile with a version gem 'devise', '~> 4.3'

But I can’t understand why it wasn’t install the newest version of devise by just write gem 'devise' without version info in Gemfile


Also, there is my Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.1.2)
      actionpack (= 5.1.2)
      nio4r (~> 2.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.1.2)
      actionpack (= 5.1.2)
      actionview (= 5.1.2)
      activejob (= 5.1.2)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.1.2)
      actionview (= 5.1.2)
      activesupport (= 5.1.2)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.1.2)
      activesupport (= 5.1.2)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.1.2)
      activesupport (= 5.1.2)
      globalid (>= 0.3.6)
    activemodel (5.1.2)
      activesupport (= 5.1.2)
    activerecord (5.1.2)
      activemodel (= 5.1.2)
      activesupport (= 5.1.2)
      arel (~> 8.0)
    activesupport (5.1.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    arel (8.0.0)
    bcrypt (3.1.11)
    bindex (0.5.0)
    builder (3.2.3)
    byebug (9.0.6)
    coffee-rails (4.2.2)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.0.5)
    devise (4.3.0)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0, < 5.2)
      responders
      warden (~> 1.2.3)
    erubi (1.6.1)
    execjs (2.7.0)
    ffi (1.9.18)
    foreman (0.84.0)
      thor (~> 0.19.1)
    globalid (0.4.0)
      activesupport (>= 4.2.0)
    i18n (0.8.6)
    jbuilder (2.7.0)
      activesupport (>= 4.2.0)
      multi_json (>= 1.2)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.6)
      mime-types (>= 1.16, < 4)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.2.0)
    minitest (5.10.2)
    multi_json (1.12.1)
    nio4r (2.1.0)
    nokogiri (1.8.0)
      mini_portile2 (~> 2.2.0)
    orm_adapter (0.5.0)
    pg (0.21.0)
    puma (3.9.1)
    rack (2.0.3)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (5.1.2)
      actioncable (= 5.1.2)
      actionmailer (= 5.1.2)
      actionpack (= 5.1.2)
      actionview (= 5.1.2)
      activejob (= 5.1.2)
      activemodel (= 5.1.2)
      activerecord (= 5.1.2)
      activesupport (= 5.1.2)
      bundler (>= 1.3.0, < 2.0)
      railties (= 5.1.2)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (5.1.2)
      actionpack (= 5.1.2)
      activesupport (= 5.1.2)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    rb-fsevent (0.10.2)
    rb-inotify (0.9.10)
      ffi (>= 0.5.0, < 2)
    responders (2.4.0)
      actionpack (>= 4.2.0, < 5.3)
      railties (>= 4.2.0, < 5.3)
    ruby_dep (1.5.0)
    sass (3.5.0)
      sass-listen (~> 3.0.7)
    sass-listen (3.0.7)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9.7)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.19.4)
    thread_safe (0.3.6)
    tilt (2.0.7)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    uglifier (3.2.0)
      execjs (>= 0.3.0, < 3)
    warden (1.2.7)
      rack (>= 1.0)
    web-console (3.5.1)
      actionview (>= 5.0)
      activemodel (>= 5.0)
      bindex (>= 0.4.0)
      railties (>= 5.0)
    webpacker (2.0)
      activesupport (>= 4.2)
      multi_json (~> 1.2)
      railties (>= 4.2)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  coffee-rails (~> 4.2)
  devise (~> 4.3)
  foreman
  jbuilder (~> 2.5)
  listen (>= 3.0.5, < 3.2)
  pg (~> 0.18)
  puma (~> 3.7)
  rails (~> 5.1.2)
  sass-rails (~> 5.0)
  tzinfo-data
  uglifier (>= 1.3.0)
  web-console (>= 3.3.0)
  webpacker

BUNDLED WITH
   1.15.1
You must be logged in to comment