gpt4 book ai didi

ruby-on-rails - 在 gemfile 中使用 bcrypt 不允许我重新启动 rails 服务器,删除它会导致浏览器出现问题(要求我将其添加回去)

转载 作者:太空宇宙 更新时间:2023-11-03 18:14:14 25 4
gpt4 key购买 nike

我看到有人询问有关 bcrypt 问题的类似查询,但没有人讨论我目前面临的这个特定问题。解决方案是重新启动 rails server 或安装 bcrypt gem,这两种方法都对我没有帮助。我正在使用 Windows 7

这是我面临的问题,
1. 如果我的 Gemfile 中有 bcrypt 3.1.7,我将无法启动 rails 服务器。命令“rails server”给我以下错误

C:\row\RailsInstaller\workspace\app2>rails s
C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1.7-x86-mingw3
2/lib/bcrypt.rb:16:in `require': cannot load such file -- bcrypt_ext (LoadError)
from C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1
.7-x86-mingw32/lib/bcrypt.rb:16:in `rescue in <top (required)>'
from C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bcrypt-3.1
.7-x86-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
from C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.
8.3/lib/bundler/runtime.rb:76:in `require'
from C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.
8.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/row/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/bundler-1.

2。如果我在我的 Gemfile 中删除 bcrypt 3.1.7,那么我就可以启动服务器,但在浏览器中我会看到这个错误

LoadError in UsersController#show
cannot load such file -- bcrypt

gem 文件

source 'https://rubygems.org'

gem 'rails', '4.2.0'
gem 'bootstrap-sass', '3.2.0.0'
gem 'bcrypt', '3.1.7'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
gem 'sqlite3'
gem 'byebug'
gem 'web-console', '~> 2.0'
gem 'spring', '1.1.3'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :test do
gem 'minitest-reporters', '1.0.5'
gem 'mini_backtrace', '0.1.3'
gem 'guard-minitest', '2.3.1'
end

group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end

Gemfile.lock

GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.0)
activesupport (= 4.2.0)
globalid (>= 0.3.0)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
arel (~> 6.0)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
ansi (1.5.0)
arel (6.0.0)
bcrypt (3.1.7-x86-mingw32)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.2.0.0)
sass (~> 3.2)
builder (3.2.2)
byebug (3.5.1)
columnize (~> 0.8)
debugger-linecache (~> 1.2)
slop (~> 3.6)
celluloid (0.16.0)
timers (~> 4.0.0)
coderay (1.1.0)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.3.0)
coffee-script-source
execjs
coffee-script-source (1.9.1)
columnize (0.9.0)
debug_inspector (0.0.2)
debugger-linecache (1.2.0)
erubis (2.7.0)
execjs (2.3.0)
ffi (1.9.6-x86-mingw32)
formatador (0.2.5)
globalid (0.3.3)
activesupport (>= 4.1.0)
guard (2.12.4)
formatador (>= 0.2.4)
listen (~> 2.7)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-minitest (2.3.1)
guard (~> 2.0)
minitest (>= 3.0)
hike (1.2.3)
hitimes (1.2.2-x86-mingw32)
i18n (0.7.0)
jbuilder (2.2.8)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (4.0.3)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.2)
listen (2.8.5)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
loofah (2.0.1)
nokogiri (>= 1.5.9)
lumberjack (1.0.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (2.4.3)
mini_backtrace (0.1.3)
minitest (> 1.2.0)
rails (>= 2.3.3)
mini_portile (0.6.2)
minitest (5.5.1)
minitest-reporters (1.0.5)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
multi_json (1.10.1)
nenv (0.2.0)
nokogiri (1.6.6.2-x86-mingw32)
mini_portile (~> 0.6.0)
notiffany (0.0.6)
nenv (~> 0.1)
shellany (~> 0.0)
pg (0.17.1-x86-mingw32)
pry (0.10.1-x86-mingw32)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
win32console (~> 1.3)
rack (1.6.0)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.0)
actionmailer (= 4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
activemodel (= 4.2.0)
activerecord (= 4.2.0)
activesupport (= 4.2.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.5)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.1)
loofah (~> 2.0)
rails_12factor (0.0.2)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.4)
rails_stdout_logging (0.0.3)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdoc (4.2.0)
json (~> 1.4)
ruby-progressbar (1.7.1)
sass (3.4.13)
sass-rails (5.0.1)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
shellany (0.0.1)
slop (3.6.0)
spring (1.1.3)
sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10-x86-mingw32)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
timers (4.0.1)
hitimes
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
tzinfo-data (1.2015.1)
tzinfo (>= 1.0.0)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
web-console (2.0.0)
activemodel (~> 4.0)
binding_of_caller (>= 0.7.2)
railties (~> 4.0)
sprockets-rails (>= 2.0, < 4.0)
win32console (1.3.2-x86-mingw32)

PLATFORMS
x86-mingw32

DEPENDENCIES
bcrypt (= 3.1.7)
bootstrap-sass (= 3.2.0.0)
byebug
coffee-rails (~> 4.1.0)
guard-minitest (= 2.3.1)
jbuilder (~> 2.0)
jquery-rails
mini_backtrace (= 0.1.3)
minitest-reporters (= 1.0.5)
pg (= 0.17.1)
rails (= 4.2.0)
rails_12factor (= 0.0.2)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
spring (= 1.1.3)
sqlite3
turbolinks
tzinfo-data
uglifier (>= 1.3.0)
web-console (~> 2.0)

我现在不知道该怎么办。有人可以帮忙吗?

最佳答案

第 1 步。将系统的 bcrypt 更新为最新;这是独立于 Rails 的。

$ gem install bcrypt -v '3.1.10'

第 2 步。使用 IRB 验证 bcrypt 是否有效;这是独立于 Rails 的。

$ irb
> gem 'bcrypt', '3.1.10'
=> true

第 3 步。如果第 1 步和第 2 步成功,则更新您的 Rails Gemfile:

gem bcrypt, '3.1.10'

第 4 步。捆绑您的 gem,以便您的 Rails 应用程序获得自己的 gem 副本:

$ bundle install 

第 5 步。使用 bundle 启动服务器:

$ bundle exec rails server

这些步骤对您来说是否成功?如果是这样,太好了。

如果没有,那么您能否编辑您的问题以准确显示哪个步骤不起作用,并复制/粘贴确切的错误消息?

关于ruby-on-rails - 在 gemfile 中使用 bcrypt 不允许我重新启动 rails 服务器,删除它会导致浏览器出现问题(要求我将其添加回去),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28776393/

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