gpt4 book ai didi

ruby-on-rails - 设计中的 LoadError::RegistrationsController#create

转载 作者:可可西里 更新时间:2023-11-01 11:24:32 26 4
gpt4 key购买 nike

我正在使用 devise 的 gem,我在 Devise::RegistrationsController#create 中收到错误 LoadError #create cannot load such file -- bcrypt_ext.. 我试图对这个问题做一些研究,也试着按照给定的说明(https://stackoverflow.com/questions/35422463/loaderror-in-deviseregistrationscontrollercreate-cannot-load-such-file-bc)

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

注意:我使用的指南是 video guide我在 Windows 7 上使用 ruby​​ on rails

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

问题是编译的 windows gem。如果删除它并只包含纯 ruby​​ 版本会更好。

解决方法一:

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

方案二:

你可以使用 gem install bcrypt --platform=ruby 即使我很难从它总是使用编译版本的 rails 中选择它

方案三:

git 克隆 https://github.com/codahale/bcrypt-ruby.git

cd bcrypt-ruby

gem 构建 bcrypt.gemspec

gem 安装 gem 编译器

gem 编译 bcrypt-3.1.10.gem

gem 安装 bcrypt-3.1.10-x64-mingw32.gem --local

关于ruby-on-rails - 设计中的 LoadError::RegistrationsController#create,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43461267/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com