Ruby on rails ruby on rails,由于bcrypt_ext(LoadError),运行服务器不工作

Ruby on rails ruby on rails,由于bcrypt_ext(LoadError),运行服务器不工作,ruby-on-rails,windows,bcrypt-ruby,Ruby On Rails,Windows,Bcrypt Ruby,我从他那里得到了宝石 然后我收到一条错误消息,如 C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7-x86-mingw32/li b/bcrypt.rb:16:in `require': cannot load such file -- bcrypt_ext (LoadError) from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/b

我从他那里得到了宝石

然后我收到一条错误消息,如

C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7-x86-mingw32/li
b/bcrypt.rb:16:in `require': cannot load such file -- bcrypt_ext (LoadError)
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7-x
86-mingw32/lib/bcrypt.rb:16:in `rescue in <top (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7-x
86-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in `each'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in `block in require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in `each'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler.rb:133:in `require'
        from C:/Projects/Mailbox/mailboxer-app/config/application.rb:14:in `<top
 (required)>'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:79:in `require'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:79:in `block in server'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:76:in `tap'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:76:in `server'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands.rb:17:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7-x86-mingw32/li
b/bcrypt.rb:16:在'require'中:无法加载这样的文件--bcrypt_ext(LoadError)
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7-x
86-mingw32/lib/bcrypt.rb:16:in“rescue in”
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7-x
86-mingw32/lib/bcrypt.rb:12:in`'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in'require'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:76:in`require中的block(2个级别)'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in'each'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:72:in'block in require'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in'each'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler/runtime.rb:61:in'require'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.7.7/
lib/bundler.rb:133:in'require'
来自C:/Projects/mailboxer/mailboxer-app/config/application.rb:14:in`'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:79:in'require'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:79:in`block in server'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:76:in'tap'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:76:in'server'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands/commands_tasks.rb:40:in'run_command!'
来自C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.4
/lib/rails/commands.rb:17:in`'
从箱子/轨道:4:in“require”
从箱子/轨道:4:in`'

此问题是特定于Windows的,在中解决

将您的文件更新为:

gem 'bcrypt-ruby', '3.1.1.rc1', :require => 'bcrypt'
然后

阅读问题,并在GitHub上阅读


更新您的Gemfile!将此添加到您的
GEM文件中

gem 'bcrypt', '3.1.9'
当心!:bcrypt-ruby
gem已将其名称更改为just
bcrypt
。而不是 安装
bcrypt-ruby
,您应该安装
bcrypt
。请更新您的 相应地,依赖关系


然后在CMD中运行命令:

bundle


该错误已在3.1.9版中修复。请勿使用bcrypt的旧版本


只需按照此链接的步骤进行操作: 这对我有用

您应该已正确安装和配置DevKit以重新编译gem

LoadError: cannot load such file -- bcrypt_ext
首先停止您的服务器并删除所有bcrypt gem或bcrypt ruby gem

C:\>gem uninstall bcrypt
You have requested to uninstall the gem:
    bcrypt-3.1.10-x86-mingw32

bcrypt-ruby-3.1.5 depends on bcrypt (>= 3.1.3)
devise-3.5.2 depends on bcrypt (~> 3.0)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled bcrypt-3.1.10-x86-mingw32
别忘了在GEM文件中包含bcrypt 宝石“bcrypt”

进行捆绑包更新并像这样重新编译gem

C:\<Ruby Path>\lib\ruby\gems\bcrypt-3.1.10-x86-mingw32\ext\mri> ruby 
extconf.rb
C:\<Ruby Path>\lib\ruby\gems\bcrypt-3.1.10-x86-mingw32\ext\mri> make
generating bcrypt_ext-i386-mingw32.def
compiling bcrypt_ext.c
compiling crypt.c
compiling crypt_blowfish.c
compiling crypt_gensalt.c
compiling wrapper.c
linking shared-object bcrypt_ext.so

(if make is not recognized as a valid command, execute this command and do a 
make again
C:\<Current Folder> C:\<DevKit Path>\devkitvars.bat
Adding the DevKit to PATH...)

C:\<Ruby Path>\lib\ruby\gems\bcrypt-3.1.10-x86-mingw32\ext\mri> make install
/usr/bin/install -c -m 0755 bcrypt_ext.so /C/<Ruby 
Path>/lib/ruby/site_ruby/2.2.0/i386-msvcrt
C:\\lib\ruby\gems\bcrypt-3.1.10-x86-mingw32\ext\mri>ruby
extconf.rb
C:\\lib\ruby\gems\bcrypt-3.1.10-x86-mingw32\ext\mri>make
生成bcrypt_ext-i386-mingw32.def
编译bcrypt_ext.c
编译crypt.c
编译crypt_blowfish.c
编译crypt_gensalt.c
编译wrapper.c
链接共享对象bcrypt_ext.so
(如果make未被识别为有效命令,请执行此命令并执行以下操作:
重做
C:\C:\\devkitvars.bat
正在将DevKit添加到路径…)
C:\\lib\ruby\gems\bcrypt-3.1.10-x86-mingw32\ext\mri>make-install
/usr/bin/install-c-m 0755 bcrypt_ext.so/c//lib/ruby/site_ruby/2.2.0/i386-msvcrt
重新启动服务器


它应该会成功的

您是否安装了
bundle
?是的,但仍然错误输出
bundle show bcrypt
?错误是rails服务器的输出,我添加了bcrypt并运行了bundle install show me输出
bundle show bcrypt
我是否需要用您编写的代码替换“gem'bcrypt','3.1.7'?我只是在前面添加了它们是的,你需要替换。请发布代码而不是链接,因为链接将来可能会更改。
C:\>gem uninstall bcrypt
You have requested to uninstall the gem:
    bcrypt-3.1.10-x86-mingw32

bcrypt-ruby-3.1.5 depends on bcrypt (>= 3.1.3)
devise-3.5.2 depends on bcrypt (~> 3.0)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]  y
Successfully uninstalled bcrypt-3.1.10-x86-mingw32
C:\<Ruby Path>\lib\ruby\gems\bcrypt-3.1.10-x86-mingw32\ext\mri> ruby 
extconf.rb
C:\<Ruby Path>\lib\ruby\gems\bcrypt-3.1.10-x86-mingw32\ext\mri> make
generating bcrypt_ext-i386-mingw32.def
compiling bcrypt_ext.c
compiling crypt.c
compiling crypt_blowfish.c
compiling crypt_gensalt.c
compiling wrapper.c
linking shared-object bcrypt_ext.so

(if make is not recognized as a valid command, execute this command and do a 
make again
C:\<Current Folder> C:\<DevKit Path>\devkitvars.bat
Adding the DevKit to PATH...)

C:\<Ruby Path>\lib\ruby\gems\bcrypt-3.1.10-x86-mingw32\ext\mri> make install
/usr/bin/install -c -m 0755 bcrypt_ext.so /C/<Ruby 
Path>/lib/ruby/site_ruby/2.2.0/i386-msvcrt