我正在尝试在rails应用程序上使用devise gem。
这就是我的所作所为:
rails new DeviseApp
cd ./DeviseApp
bundle install
然后我转到项目中的gemfile并输入代码:
gem 'devise'
之后,我执行另一个bundle install
然后我尝试以下操作:rails generate devise:install
我收到以下错误:
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'devise'.
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/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:14:in `<class:RouteSet>'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:2:in `<module:Routing>'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/devise-1.5.4/lib/devise/rails/routes.rb:1:in `<top (required)>'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `block in require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/devise-1.5.4/lib/devise/rails.rb:1:in `<top (required)>'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `block in require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/devise-1.5.4/lib/devise.rb:445:in `<top (required)>'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'
/Users/lechucico/Documents/rails/DeviseApp/config/application.rb:7:in `<top (required)>'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:82:in `require'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:82:in `preload'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:143:in `serve'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `run'
/Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>'
/Users/lechucico/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/lechucico/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
-e:1:in `<main>'
Bundler Error Backtrace:
(Bundler::GemRequireError)
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:90:in `block (2 levels) in require'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'
from /Users/lechucico/Documents/rails/DeviseApp/config/application.rb:7:in `<top (required)>'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:82:in `require'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:82:in `preload'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:143:in `serve'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `run'
from /Users/lechucico/.rvm/gems/ruby-2.4.0@rails5.0/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>'
from /Users/lechucico/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/lechucico/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
我能做什么?
答案 0 :(得分:1)
在设计的主分支中有一个修复。您可以通过在gemfile中包含以下行来直接安装它:
gem 'devise', git: 'https://github.com/plataformatec/devise.git', branch: 'master'
gem 'erubis'
参见讨论here