LoadError in Devise :: RegistrationsController#create

我正在使用devise的gem,我得到错误LoadiseError在Devise :: RegistrationsController#创build不能加载这样的文件 – bcrypt_ext ..我试图做一些研究有关这个问题,也试图按照给出的指示(https: //stackoverflow.com/questions/35422463/loaderror-in-deviseregistrationscontrollercreate-cannot-load-such-file-bc)

但仍然有这个问题。 任何build议?

注:我正在使用的指南是video指南 ,我正在使用Windows 7上的轨道上的ruby

gem文件

source 'https://rubygems.org' git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end # error in devise gem 'bcrypt-ruby', '~> 3.1', '>= 3.1.5' # Bundle for authentication gem 'devise', '~> 4.2', '>= 4.2.1' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.0.rc1' # Use postgresql as the database for Active Record gem 'pg', '~> 0.18' # Use Puma as the app server gem 'puma', '~> 3.7' # Use SCSS for stylesheets gem 'sass-rails', github: "rails/sass-rails" # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # 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' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] # Adds support for Capybara system testing and selenium driver gem 'capybara', '~> 2.13.0' gem 'selenium-webdriver' end group :development do # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. gem 'web-console', '>= 3.3.0' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 

我也有同样的错误,我的问题得到解决,请尝试解决方案3

问题是编译的窗口宝石。 如果删除它只会包括纯ruby版本会更好。

解决方案一:

您可以将bcrypt_ext.so从\ lib \ 2.1复制到\ lib \ bcrypt.rb所在的文件夹

解决方案二:

你可以使用gem install bcrypt –platform = ruby​​,即使我从使用编译版本的rails中选择它,

解决方案三:

git clone https://github.com/codahale/bcrypt-ruby.git

cd bcrypt-ruby

宝石生成bcrypt.gemspec

gem install gem-compiler

宝石编译bcrypt-3.1.10.gem

gem install bcrypt-3.1.10-x64-mingw32.gem –local

请做一件事,它会解决你的问题

删除版本,休息只是写在你的Gemfile中

 gem 'bcrypt-ruby'