gpt4 book ai didi

ruby-on-rails - 当我运行 rspec 时,我收到一条错误消息,声称 bcrypt-ruby 不是包的一部分

转载 作者:太空宇宙 更新时间:2023-11-03 16:08:22 26 4
gpt4 key购买 nike

我已经绝对确定 bcrypt-ruby 已列在 gemfile 中,我已经尝试要求不同版本的 bcrypt-ruby,我已检查它是否与所有其他 gem 安装在同一位置。我正在使用带有 RVM、rails 3.2 的 ruby​​ 版本 1.9.3。我试过卸载并重新安装 ruby 。当我运行 bundle exec rspec spec/ 时,我得到了这个:

Exception encountered: #<Gem::LoadError: bcrypt-ruby is not part of the bundle. Add it to Gemfile.>
backtrace:
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/rubygems_integration.rb:143:in `block in replace_gem'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activemodel-3.2.1/lib/active_model/secure_password.rb:37:in `has_secure_password'
/Documents/Projects/sample_app/app/models/user.rb:3:in `<class:User>'
/Documents/Projects/sample_app/app/models/user.rb:1:in `<top (required)>'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:359:in `require_or_load'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:502:in `load_missing_constant'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:192:in `block in const_missing'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `each'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:190:in `const_missing'
/Documents/Projects/sample_app/spec/models/user_spec.rb:3:in `<top (required)>'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `block in load'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/monkey/spork/test_framework/rspec.rb:7:in `run_tests'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:13:in `block in run'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/spork-0.9.0/lib/spork/forker.rb:21:in `block in initialize'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/spork-0.9.0/lib/spork/forker.rb:18:in `fork'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/spork-0.9.0/lib/spork/forker.rb:18:in `initialize'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:9:in `new'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/spork-0.9.0/lib/spork/run_strategy/forking.rb:9:in `run'
/Users/jon-eriknissen/.rvm/gems/ruby-1.9.3-p0/gems/spork-0.9.0/lib/spork/server.rb:48:in `run'
/Users/jon-eriknissen/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/Users/jon-eriknissen/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/Users/jon-eriknissen/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/Users/jon-eriknissen/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/Users/jon-eriknissen/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'

非常感谢任何帮助。

这是 Gemfile

source 'https://rubygems.org'

gem 'rails', '3.2.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.8.1'
gem 'guard-rspec', '0.5.5'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.2'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'

gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails', '2.0.0'

group :development do
gem 'sqlite3', '1.3.5'
end

group :test do
gem 'rspec-rails', '2.8.1'
gem 'capybara', '1.1.2'
gem 'rb-fsevent', '0.4.3.1', :require => false
gem 'growl', '1.0.3'
gem 'guard-spork', '0.3.2'
gem 'spork', '~> 0.9.0.rc'
gem 'factory_girl_rails', '1.4.0'
end

group :production do
gem 'pg', '0.12.2'
end

# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

最佳答案

因为如果在开发过程中修改了gemfile,需要重启服务器。

关于ruby-on-rails - 当我运行 rspec 时,我收到一条错误消息,声称 bcrypt-ruby 不是包的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9165066/

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