Devise中的LoadError :: RegistrationsController #create

时间:2017-04-17 23:38:01

标签: ruby-on-rails windows devise

我正在使用设计的宝石,我在Devise中遇到错误LoadError :: RegistrationsController #create无法加载这样的文件--bcrypt_ext ..我试着对这个问题做一些研究,并试图按照给出的指示(https://stackoverflow.com/questions/35422463/loaderror-in-deviseregistrationscontrollercreate-cannot-load-such-file-bc)

但仍有这个问题。有什么建议吗?

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

宝石文件

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]

2 个答案:

答案 0 :(得分:2)

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

问题是编译的windows gem。如果它被删除并且只包含纯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

gem build bcrypt.gemspec

gem install gem-compiler

gem compile bcrypt-3.1.10.gem

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

答案 1 :(得分:1)

请做一件事,它将解决您的问题

删除版本,然后将其写入Gemfile

gem 'bcrypt-ruby'
相关问题