所以我试图运行rake db:migrate并在终端中收到此错误?
rake aborted!
LoadError: cannot load such file -- bcrypt_ext
C:/Users/Josh/loveapp/app/models/user.rb:4:in `<class:User>'
C:/Users/Josh/loveapp/app/models/user.rb:1:in `<top (required)>'
C:/Users/Josh/loveapp/config/routes.rb:2:in `block in <top (required)>'
C:/Users/Josh/loveapp/config/routes.rb:1:in `<top (required)>'
C:-1:in `execute_if_updated'
C:/Users/Josh/loveapp/config/environment.rb:5:in `<top (required)>'
LoadError: cannot load such file -- 2.2/bcrypt_ext
C:/Users/Josh/loveapp/app/models/user.rb:4:in `<class:User>'
C:/Users/Josh/loveapp/app/models/user.rb:1:in `<top (required)>'
C:/Users/Josh/loveapp/config/routes.rb:2:in `block in <top (required)>'
C:/Users/Josh/loveapp/config/routes.rb:1:in `<top (required)>'
C:-1:in `execute_if_updated'
C:/Users/Josh/loveapp/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
我最近将bcrypt添加到我的gemfile中,因为我尝试运行“rails destroy devise user”,它给了我一个关于bcrypt的错误然后我去堆栈溢出,有人说要添加到你的gemfile。但它没有给我的特定版本,(是一个过时的宝石文件)我刚刚添加了这个:
source 'https://rubygems.org'
ruby '2.2.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-script-source', '1.8.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'bootstrap-sass'
gem 'devise', '~> 3.1.0.rc2'
gem 'bcrypt-ruby'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :doc do
gem 'sdoc', require: false
end
答案 0 :(得分:0)
运行bundle install
从终端安装bcrypt并重新运行bundle exec rake db:migrate