2016-02-16 28 views
0

我使用的是Ruby 2.2.4。当我在安装Devise gem后尝试注册时,出现此错误。当我使用ruby 2.1.5时,我从来没有遇到过这个错误。这里的ruby版本是错误的原因吗?Devise :: RegistrationsController中的LoadError#create(无法加载这样的文件 - bcrypt_ext)。为什么我会得到这个错误?

UPDATE:这是我的Gemfile看起来像,我使用的是Windows 7专业版64位

source 'https://rubygems.org' 


gem 'rails', '4.2.5.1' 
gem 'sqlite3' 
gem 'sass-rails', '~> 5.0' 
gem 'uglifier', '>= 1.3.0' 
gem 'coffee-rails', '~> 4.1.0' 
gem 'jquery-rails' 
gem 'turbolinks' 
gem 'jbuilder', '~> 2.0' 
gem 'simple_form', '~> 3.2', '>= 3.2.1' 
gem 'country_select', '~> 2.5', '>= 2.5.1' 
gem 'devise', '~> 3.5', '>= 3.5.6' 

group :doc do 
    gem 'sdoc', '~> 0.4.0' 
end 


group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug' 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> in views 
    gem 'web-console', '~> 2.0' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 
+0

看着你的Gemfile并张贴bcrypt应用程序正在使用的版本。让我们知道您正在使用的操作系统。 – MarsAtomic

+0

@MarsAtomic请参阅我的更新! –

回答

1

设计3.5.6需求bcrypt < = 3.0,你可能有,但有些版本bcrypt不支持在Windows上使用特定版本的Ruby,这可能是您所看到的。

这是我挖出来的bcrypt github repo

1) Launch a terminal session 
2) Enter gem uninstall bcrypt 
3) Enter gem uninstall bcrypt-ruby 
4) Enter gem install bcrypt --platform=ruby 
5) Edit your gemfile to include the following line: 
    gem 'bcrypt-ruby', '3.1.5', :require => 'bcrypt' 
6) Run bundle install 
+0

当我添加gem'bcrypt-ruby','3.1.5',:require =>'bcrypt'并捆绑安装它时,服务器将不再运行。 –

+0

你是什么意思“不会跑?”日志中是否包含错误消息?它挂了吗? – MarsAtomic

+0

当我运行rails服务器时,它返回一个长错误。但是,当我删除'bcrypt-ruby','3.1.5',:require =>'bcrypt'并运行rails服务器时,它运行,但问题仍然没有解决。 –

相关问题