2017-01-12 3 views
4

Devise for Rails 5.0.1の使用中に、現在bcryptの暗号化装置に障害が発生しています。これまでのRails 4.2ではこの問題は一度もありませんでした。私はDeviseを通じて新しいユーザーを登録することはできません。私は私のgemfileとサーバーログに関する情報を投稿します。そのようなファイルを読み込めません - bcrypt_ext

Gemfile.rb

gem 'bcrypt', platforms: :ruby 

# Devise 
gem 'devise' 
gem 'devise_security_extension' 

gem 'redis' 
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 5.0.1' 

Serverのログ

Started POST "/register" for 127.0.0.1 at 2017-01-12 13:50:05 -0500 
Processing by Users::RegistrationsController#create as HTML 
    Parameters: {"utf8"=>"✓", "authenticity_token"=>"bH6n7iWLhPMECDzTVkMyTc9FXtvkGrq5+K4wFs1g8Bxbjq9ShaLJP5gn72SFQlHc01j2ao5JKcv57ClWAzwsmw==", "user"=>{"email"=>"[email protected]", "username"=>"codex", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"} 
Completed 500 Internal Server Error in 258ms (ActiveRecord: 0.0ms) 



LoadError - cannot load such file -- bcrypt_ext: 
    activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `block in require' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:259:in `load_dependency' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require' 
    bcrypt-3.1.11-x86 (mingw32) lib/bcrypt.rb:16:in `rescue in <top (required)>' 
    bcrypt-3.1.11-x86 (mingw32) lib/bcrypt.rb:12:in `<top (required)>' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `block in require' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:259:in `load_dependency' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require' 
    devise (4.2.0) lib/devise/encryptor.rb:1:in `<top (required)>' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `block in require' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:259:in `load_dependency' 
    activesupport (5.0.1) lib/active_support/dependencies.rb:293:in `require' 
    devise (4.2.0) lib/devise/models/database_authenticatable.rb:147:in `password_digest' 
    devise (4.2.0) lib/devise/models/database_authenticatable.rb:40:in `password=' 
    activemodel (5.0.1) lib/active_model/attribute_assignment.rb:46:in `public_send' 
    activemodel (5.0.1) lib/active_model/attribute_assignment.rb:46:in `_assign_attribute' 
    activemodel (5.0.1) lib/active_model/attribute_assignment.rb:40:in `block in _assign_attributes' 
    activemodel (5.0.1) lib/active_model/attribute_assignment.rb:39:in `each' 
    activemodel (5.0.1) lib/active_model/attribute_assignment.rb:39:in `_assign_attributes' 
    activerecord (5.0.1) lib/active_record/attribute_assignment.rb:26:in `_assign_attributes' 
    activemodel (5.0.1) lib/active_model/attribute_assignment.rb:33:in `assign_attributes' 
    activerecord (5.0.1) lib/active_record/core.rb:319:in `initialize' 
    activerecord (5.0.1) lib/active_record/inheritance.rb:65:in `new' 
    activerecord (5.0.1) lib/active_record/inheritance.rb:65:in `new' 
    devise (4.2.0) lib/devise/models/registerable.rb:20:in `new_with_session' 
    devise (4.2.0) app/controllers/devise/registrations_controller.rb:100:in `build_resource' 
    devise (4.2.0) app/controllers/devise/registrations_controller.rb:15:in `create' 
    actionpack (5.0.1) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' 
    actionpack (5.0.1) lib/abstract_controller/base.rb:188:in `process_action' 
    actionpack (5.0.1) lib/action_controller/metal/rendering.rb:30:in `process_action' 
    actionpack (5.0.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action' 
    activesupport (5.0.1) lib/active_support/callbacks.rb:126:in `call' 
    activesupport (5.0.1) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile' 
    activesupport (5.0.1) lib/active_support/callbacks.rb:455:in `call' 
    activesupport (5.0.1) lib/active_support/callbacks.rb:101:in `__run_callbacks__' 
    activesupport (5.0.1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks' 
    activesupport (5.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks' 
    actionpack (5.0.1) lib/abstract_controller/callbacks.rb:19:in `process_action' 
    actionpack (5.0.1) lib/action_controller/metal/rescue.rb:20:in `process_action' 
    actionpack (5.0.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' 
    activesupport (5.0.1) lib/active_support/notifications.rb:164:in `block in instrument' 
    activesupport (5.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument' 
    activesupport (5.0.1) lib/active_support/notifications.rb:164:in `instrument' 
    actionpack (5.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action' 
    actionpack (5.0.1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action' 
    activerecord (5.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action' 
    actionpack (5.0.1) lib/abstract_controller/base.rb:126:in `process' 
    actionview (5.0.1) lib/action_view/rendering.rb:30:in `process' 
    actionpack (5.0.1) lib/action_controller/metal.rb:190:in `dispatch' 
    actionpack (5.0.1) lib/action_controller/metal.rb:262:in `dispatch' 
    actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch' 
    actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve' 
    actionpack (5.0.1) lib/action_dispatch/routing/mapper.rb:16:in `block in <class:Constraints>' 
    actionpack (5.0.1) lib/action_dispatch/routing/mapper.rb:46:in `serve' 
    actionpack (5.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve' 
    actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `each' 
    actionpack (5.0.1) lib/action_dispatch/journey/router.rb:26:in `serve' 
    actionpack (5.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call' 
    rack (2.0.1) lib/rack/deflater.rb:35:in `call' 
    warden (1.2.6) lib/warden/manager.rb:35:in `block in call' 
    warden (1.2.6) lib/warden/manager.rb:34:in `catch' 
    warden (1.2.6) lib/warden/manager.rb:34:in `call' 
    rack (2.0.1) lib/rack/etag.rb:25:in `call' 
    rack (2.0.1) lib/rack/conditional_get.rb:38:in `call' 
    rack (2.0.1) lib/rack/head.rb:12:in `call' 
    rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context' 
    rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call' 
    actionpack (5.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call' 
    activerecord (5.0.1) lib/active_record/migration.rb:553:in `call' 
    actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call' 
    activesupport (5.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__' 
    activesupport (5.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks' 
    activesupport (5.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks' 
    actionpack (5.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call' 
    actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call' 
    actionpack (5.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call' 
    better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call' 
    better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call' 
    better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call' 
    actionpack (5.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call' 
    web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app' 
    web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call' 
    web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch' 
    web-console (3.4.0) lib/web_console/middleware.rb:18:in `call' 
    actionpack (5.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' 
    railties (5.0.1) lib/rails/rack/logger.rb:36:in `call_app' 
    railties (5.0.1) lib/rails/rack/logger.rb:24:in `block in call' 
    activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `block in tagged' 
    activesupport (5.0.1) lib/active_support/tagged_logging.rb:26:in `tagged' 
    activesupport (5.0.1) lib/active_support/tagged_logging.rb:69:in `tagged' 
    railties (5.0.1) lib/rails/rack/logger.rb:24:in `call' 
    sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call' 
    actionpack (5.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call' 
    rack (2.0.1) lib/rack/method_override.rb:22:in `call' 
    rack (2.0.1) lib/rack/runtime.rb:22:in `call' 
    activesupport (5.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' 
    actionpack (5.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call' 
    actionpack (5.0.1) lib/action_dispatch/middleware/static.rb:136:in `call' 
    rack (2.0.1) lib/rack/sendfile.rb:111:in `call' 
    railties (5.0.1) lib/rails/engine.rb:522:in `call' 
    puma (3.6.2) lib/puma/configuration.rb:225:in `call' 
    puma (3.6.2) lib/puma/server.rb:578:in `handle_request' 
    puma (3.6.2) lib/puma/server.rb:415:in `process_client' 
    puma (3.6.2) lib/puma/server.rb:275:in `block in run' 
    puma (3.6.2) lib/puma/thread_pool.rb:116:in `block in spawn_thread' 

Started POST "/__better_errors/4e4442c3f810d7b9/variables" for 127.0.0.1 at 2017-01-12 13:50:06 -0500 
+0

Rubyのどのバージョンを使用していますか?このプロジェクトでは – spickermann

+0

ruby​​ 2.3.1です。 – valcod3r

答えて

8

私はルビー2.3.3とRails 4.2.4で今日同様の問題がありました。

問題が工夫のbundle installが依存としてルビー2.3に問題を引き起こしていたbcryptの別のバージョンを(bcrypt (3.1.11 x86-mingw32)代わりbcrypt (3.1.11)の)インストールされていることであった

溶液I(それはルビーのすべての以前のバージョンで動作するはず)

$ gem list bcrypt 
bcrypt (3.1.11 x86-mingw32) 

$ gem uninstall devise && gem uninstall bcrypt 
Successfully uninstalled devise-4.2.0 
Successfully uninstalled bcrypt-3.1.11-x86-mingw32 

$ gem install bcrypt --platform=Ruby 
Temporarily enhancing PATH to include DevKit... 
Building native extensions. This could take a while... 
Successfully installed bcrypt-3.1.11 
Parsing documentation for bcrypt-3.1.11 
Installing ri documentation for bcrypt-3.1.11 
Done installing documentation for bcrypt after 1 seconds 
1 gem installed 

$ gem list bcrypt 
bcrypt (3.1.11) 

$ bundle install 
... 
Installing bcrypt 3.1.11 (x86-mingw32) 
... 
Installing devise 4.2.0 
Bundle complete! 25 Gemfile dependencies, 75 gems now installed. 

$ gem list bcrypt 
bcrypt (3.1.11 ruby x86-mingw32) 

$ gem uninstall bcrypt 
Select gem to uninstall: 
1. bcrypt-3.1.11 
2. bcrypt-3.1.11-x86-mingw32 
3. All versions 
> 2 
Successfully uninstalled bcrypt-3.1.11-x86-mingw32 

$ gem list bcrypt 
bcrypt (3.1.11) 

希望あなたはまだあなたの問題を解決していない場合に役立ちます:bcryptの2番目のバージョンをbcryptのgemfileの外、実行バンドルをインストールしてから削除している使用。

0

おそらく、ネイティブバイナリが誤ってビルドまたは破損しているだけです。宝石\ \ RailsInstaller \ Ruby2.2.0 \ libに\ルビー\宝石\ 2.2.0 \ bcryptの-3.1.10-のx86-MINGW32:

  1. オープン宝石のディレクトリCコマンドコンソール
  2. CDの下に試してみてください\ ext \ mri
  3. ruby​​ extconf.rbを実行してください。 Makefileを作成する必要があります。
  4. makeを実行してください。拡張ライブラリをビルドします。
  5. ランは

をmake installを私も同じ問題に遭遇したFix issue "cannot load such file -- bcrypt_ext (LoadError)"

4

でより多くを参照してください、そして、私はいくつかの参照を発見し、それが唯一のバージョンについてです。私は

bcrypt 3.1.11-x86-mingw32(the latest now) 

から

bcrypt 3.1.0-x86-mingw32 

に戻ってbcryptの変更した場合

はその後、それが正常に動作しますgemfile

gem 'bcrypt-ruby', '3.1.0', :require => 'bcrypt' 

にもう一度確認してください。

0

MS勝利10と8で問題を解決するためにこれらのステップ

  1. アンインストールのlib /ルビー/宝石/ 2.3.0 /宝石/ bcryptの-3.1上のすべてのbcryptの

    gem uninstall bcrypt 
    
  2. ゴー.11-x86-mingw32/lib /およびcopy bcrypt_ext.soファイル。今のところデスクトップに貼り付けてください。

  3. をアンインストールし、すべてのbcryptの再

    gem uninstall bcrypt 
    
  4. 実行して、フォルダのlib /ルビーにbcrypt_ext.soコピー

    bundle install 
    bundle update 
    
  5. 貼り付けコマンドは、プロジェクトのgemfileに

    gem 'bcrypt', '~> 3.1.7' 
    
  6. を追加します。 /gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/lib/デスクトップ。それは勝利7および10上で動作します

  7. 再起動サーバ

    rails server 
    

関連する問題