我遵循此处提到的基本说明:http://guides.spreecommerce.com/getting_started.html
BTW我的Gemfile中已经有gem 'devise-encryptable'
。
当我cd
进入mystore
并尝试运行spree install
时,这就是我得到的错误:
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/devise-encryptable-0.1.1/lib/devise/encryptable/encryptable.rb:28:in `<top (required)>': undefined method `add_module' for Devise:Module (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/devise-encryptable-0.1.1/lib/devise-encryptable.rb:1:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/devise-encryptable-0.1.1/lib/devise-encryptable.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /Users/amiterandole/Desktop/current/rails/mystore/config/application.rb:7:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.11/lib/rails/commands.rb:24:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.11/lib/rails/commands.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
发生了什么,我该如何解决?我碰巧使用了最新版本的rails和spree。我安装的设计版本是devise-2.2.2
更新:这是我的宝石文件
source 'https://rubygems.org'
gem 'rails', '3.2.11'
gem 'pg'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'devise-encryptable'
# To use debugger
# gem 'debugger'
gem 'spree', '1.3.1'
gem 'spree_gateway', :github => 'spree/spree_gateway', :branch => '1-3-stable'
gem 'spree_auth_devise', :github => 'spree/spree_auth_devise', :branch => '1-3-stable'
答案 0 :(得分:9)
尝试放置此行
gem 'devise-encryptable'
在Gemfile的底部。这解决了我的问题。设备加密宝石可能会找到旧版本的Devise,它没有Devise.add_module方法。
答案 1 :(得分:1)
我刚才遇到了这个错误,并找到了解决方案。您需要在gem的目录中打开文件lib/devise-encryptable.rb
,并在开头添加此行:require 'devise'
。不要忘记关注this advice。享受。
答案 2 :(得分:0)
从Gemfile中删除gem 'devise-encryptable'
,因为它已被指定为spree_auth_devise
gem中的依赖项。这里发生的是这个gem正在devise
gem之前加载,这就是你的应用程序崩溃的原因。