Ruby on rails Rails服务器表示无法加载bcrypt gem?

Ruby on rails Rails服务器表示无法加载bcrypt gem?,ruby-on-rails,ruby,bcrypt,Ruby On Rails,Ruby,Bcrypt,当我尝试执行此操作时,我得到“LoadError(无法加载这样的文件--bcrypt)” 如何让它加载bcrypt gem? 我正在使用Windows 10。请尝试以下操作: 从GEM文件中删除bcrypt 通过运行gem Uninstall bcrypt从系统中卸载 添加gem'bcrypt',git:'https://github.com/codahale/bcrypt-ruby.git“,:require=>bcrypt'到您的GEM文件 运行捆绑安装 如果出现错误,请安装Git并重试捆绑

当我尝试执行此操作时,我得到“LoadError(无法加载这样的文件--bcrypt)”

如何让它加载bcrypt gem? 我正在使用Windows 10。

请尝试以下操作:

  • 从GEM文件中删除
    bcrypt
  • 通过运行
    gem Uninstall bcrypt
    从系统中卸载
  • 添加
    gem'bcrypt',git:'https://github.com/codahale/bcrypt-ruby.git“,:require=>bcrypt'
    到您的GEM文件
  • 运行
    捆绑安装
  • 如果出现错误,请安装Git并重试
    捆绑安装

  • 来源:

    捆绑检查
    会说什么?“Gemfile的依赖关系得到满足”您如何运行您的站点?该错误显示在哪里?当我尝试加载使用该控制器的一个页面时,它会显示错误。浏览器中加载的错误指向“require bcrypt”行,如果我取出该行,则指向模型中的“has_secure_password”行。我将用用户模型中的代码更新我的问题。可能是运行应用程序的Ruby与在命令行上运行的Ruby不同。这两种方法都不起作用。即使安装了git,它也会说“不幸的是,发生了一个意外错误,Bundler无法继续”。它说的不止这些还是仅此而已?我不知道这为什么上周不起作用,但我只是再试了一次,它成功了!非常感谢你!!!
    require 'bcrypt'
    
    class PublicController < ApplicationController
    
      def attempt_login
            if params[:email].present? && params[:password].present?
                found_user = User.where(:email => params[:email]).first
                if found_user
                    authorized_user = found_user.authenticate(params[:password])
                end
            end
            if authorized_user
                render(:text =>'authorized')
                redirect_to(:controller => 'private', :action => 'home')
            else
                flash[:notice] = "Invalid email or password"
                render :new
            end
      end
    end
    
    class User < ApplicationRecord
    has_secure_password
    end
    
    gem 'bcrypt', '~>3.1.11'
    gem 'bcrypt', '~> 3.1', '>= 3.1.11'
    gem 'bcrypt', platforms: :ruby