Bcryptを使ってメンバー登録時のパスワードを暗号化したい。
初投稿です。Daiと申します。
Ruby on Railsを使ってWebサイトを作っているのですが、パスワード登録時の暗号化のためにGemパッケージのBcryptをbundle installでインストールしたところサーバーがLoadErrorで起動しなくなりました。
Googleで解決策を探したところ↓のサイトに解決策が載っていたので試したのですが今度はgem install bcrypt --platform=rubyでまた別のエラーが出てしまいました。(-_-;)
(https://qiita.com/totto357/items/1741da83bf642dab99df)
gem uninstall bcrypt を実行
gem uninstall bcrypt-ruby を実行
gem install bcrypt --platform=rubyを実行
Gemfileにgem 'bcrypt', '~> 3.1.11'を記載
bundle installを実行
別のヴァージョンのbcryptをインストールしてみましたが結果は同じでした。
どなたか僕と同じ状況で解決した方がいれば方法を教えていただけないでしょうか。
よろしくお願いします。。
発生している問題・エラーメッセージ
bin/rails sをコマンドプロンプトで入力した時のエラー↓ C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.7-x86-mingw32/lib/bcrypt.rb:16:in `require': cannot load such file -- bcrypt_ext (LoadError) from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.7-x86-mingw32/lib/bcrypt.rb:16:in `rescue in <top (required)>' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.7-x86-mingw32/lib/bcrypt.rb:12:in `<top (required)>' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:81:in `require' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:81:in `block (2 levels) in require' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `each' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:76:in `block in require' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `each' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:65:in `require' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler.rb:114:in `require' from C:/rails/gruppe/config/application.rb:7:in `<top (required)>' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:88:in `require' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:88:in `block in server' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `tap' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `server' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!' from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>' bin/rails bcrypt --platform=ruby入力時のエラー↓ C:\rails\gruppe>gem install bcrypt --platform=ruby Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing bcrypt: ERROR: Failed to build gem native extension. current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.12/ext/mri C:/Ruby23/bin/ruby.exe -r ./siteconf20180518-12416-15fz6dm.rb extconf.rb creating Makefile current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.12/ext/mri make "DESTDIR=" clean 'make' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.12/ext/mri make "DESTDIR=" 'make' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 make failed, exit code 1 Gem files will remain installed in C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.12 for inspection. Results logged to C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/bcrypt-3.1.12/gem_make.out
追記 install bcrypt --platform=rubyコマンド時のエラー
C:\rails\gruppe>gem install bcrypt --platform=ruby Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing bcrypt: ERROR: Failed to build gem native extension. current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.12/ext/mri C:/Ruby23/bin/ruby.exe -r ./siteconf20180522-6184-128mqrj.rb extconf.rb creating Makefile current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.12/ext/mri make "DESTDIR=" clean 'make' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.12/ext/mri make "DESTDIR=" 'make' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。 make failed, exit code 1 Gem files will remain installed in C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.12 for inspection. Results logged to C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/bcrypt-3.1.12/gem_make.out
該当のソースコード
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 3.0' # Use ActiveModel has_secure_password gem 'bcrypt', '~> 3.1.7' ↑BcryptのGem gem 'coffee-script-source', '1.8.0' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development
補足情報(FW/ツールのバージョンなど)
OS Windows10 64bit
Ruby2.3.0
Ruby on Rails5.0.6
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/05/23 03:06