2017-11-27 13 views
0

이 문제에 대한 해결책을 찾는 데 어려움을 겪고 있으며 다른 사람들이 성공하지 못했던 여러 가지 수정 사항을 시도했습니다. Michael Hartl이 만든 Ruby on Rails 5 튜토리얼에서 bcrypt를 사용하여 has_secure_password 기능을 구현해야합니다. 내가 테스트를 실행할 때 나는로 시작하는 긴 오류 메시지가 얻을 :bcrypt 레일즈가있는 LoadError

C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in 'require': cannot load such file -- bcrypt_ext (LoadError) 

내가 제거하고 마지막에 --platform=ruby을 추가하고 gemfile의 다양한 버전을 포함한 bcrypt 다시 설치 시도를; gem 'bcrypt', '~> 3.1.7', 'bcrypt', '3.1.11', platforms: [:ruby, :x64_mingw], 'bcrypt', '~> 3.1.7', platforms: [:ruby]은 명령 줄에서 gem 파일을 설치하는 다양한 조합을 포함합니다. 콘솔에서 설치하는 동안 gemfile을 남겨두고 gemfile 링크만으로 번들 설치를 제거하고 실행합니다.

C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in 'require': cannot load such file -- bcrypt_ext (LoadError) 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in `rescue in <top (required)>' 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:12:in `<top (required)>' 
    from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:81:in `require' 
    from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:81:in `block (2 levels) in require' 
    from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:76:in `each' 
    from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:76:in `block in require' 
    from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:65:in `each' 
    from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:65:in `require' 
    from C:/Ruby23-x64/lib/ruby/site_ruby/2.3.0/bundler.rb:114:in `require' 
    from C:/Users/Bill/Documents/Sites/sample_app/config/application.rb:7:in `<top (required)>' 
    from C:/Ruby23x64/lib/ruby/gems/2.3.0/gems/railties-.1.4/lib/rails/command/actions.rb:15:in `require' 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/actions.rb:15:in `require_application_and_environment!' 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:96:in `perform' 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in`run' 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command' 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch' 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform' 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke' 
    from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `<main>' 

내가 루비 버전 2.3.3을 사용하고 레일에 버전 5.1.4 실행하는 Windows 7x64에 :

이 레일 콘솔에 액세스하려고 할 때 나는 수신하고 전체 오류 메시지입니다.

아무도 통찰력이 아무도이 시점에서 나를 제공 할 수있는 것이 주시면 감사하겠습니다.

UPDATE

수많은 시간이 gemfile를 사용하여 문제를 해결하기 위해 노력하고 그래서 후에

:

gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' 

나를 위해 문제를 해결 것이었다. 이것은 영구적 인 해결책은 아닐지 모르지만, 적어도 앞으로 나아갈 수 있습니다!

답변

1

최근의 해결 방법을 찾고 싶지만 몇 달 전에 Rails 5.0에서이 문제가 발생했을 때 나는 수락 된 대답 from this stack overflow question을 사용했으며 저에게 효과적이었습니다.

업데이트 : 제안 된대로 링크가 작동하지 않을 경우 완전한 대답을 추가했습니다. 대신 죽은 링크 문제를 피할 수 링크를 참조하는

gem 'bcrypt','~>3.1.11' # Or current version 
+0

더 나은 쓰기 답변 : 제일 - 제거는 그런 다음 Gemfile에 그런

gem install bcrypt --platform=ruby 

를 다시 설치
gem uninstall bcrypt-ruby 

을 bcrypt. –

+1

@Satishakumar Awati -Noted – born2bmild

+0

그래서 Rails Console에 다시 액세스 할 수 있었지만 새 프로젝트를 설정할 때 오류 메시지가 계속 나타납니다. 제안 된 모든 것을 실행하려고 시도했지만 아무 소용이 없습니다. – BaracudaBill