生成模型后,Ruby gem devise错误 [英] Ruby gem devise error after generating model

查看:67
本文介绍了生成模型后,Ruby gem devise错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从昨天开始,我一直在解决这个问题,我已经在互联网上进行搜索,而且似乎很多人在运行 rails generate devise User后也遇到了同样的错误。

I've been stuck on this problem since yesterday now, I've scoured the internet and it seems a lot of people have had this same error after running 'rails generate devise User'

我正在运行我认为是Devise(3.0.0.rc)的最新版本,并且当我尝试运行 rails server时,出现以下错误消息。 (我在安装时遵循了devise给出的指示)。

I'm running what I believe to be the latest version of Devise (3.0.0.rc) and when I try to run 'rails server', I get the below error message. (I followed the insructions given by devise upon install)

我无法销毁模型,无法迁移数据库,必须删除整个项目,

I can't destroy the model, I can't migrate my db and I have to delete the whole project and start again every time.

请帮助!

C:\Sites\blogbar>rails server
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/act
ive_support/dependencies.rb:228:in `require': cannot load such file -- 1.9/bcryp
t_ext (LoadError)
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:211:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:615:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:211:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-3.
1.0-x86-mingw32/lib/bcrypt_ext.rb:2:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:211:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:615:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:211:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-3.
1.0-x86-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:211:in `block in load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:615:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:211:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/models/database_authenticatable.rb:2:in `<top (required
)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/models.rb:97:in `const_get'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/models.rb:97:in `block (2 levels) in devise'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/models.rb:92:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/models.rb:92:in `block in devise'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/models.rb:123:in `devise_modules_hook!'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/models.rb:90:in `devise'
        from C:/Sites/blogbar/app/models/user.rb:5:in `<class:User>'
        from C:/Sites/blogbar/app/models/user.rb:1:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:423:in `load'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:423:in `block in load_file'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:615:in `new_constants_in'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:422:in `load_file'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:323:in `require_or_load'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:462:in `load_missing_constant'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:183:in `const_missing'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/inflector/methods.rb:226:in `const_get'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/inflector/methods.rb:226:in `block in constantize'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/inflector/methods.rb:224:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/inflector/methods.rb:224:in `inject'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/inflector/methods.rb:224:in `constantize'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:534:in `get'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:565:in `constantize'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise.rb:274:in `get'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/mapping.rb:77:in `to'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/mapping.rb:72:in `modules'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/mapping.rb:89:in `routes'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/mapping.rb:156:in `default_used_route'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/mapping.rb:66:in `initialize'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise.rb:308:in `new'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise.rb:308:in `add_mapping'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/rails/routes.rb:208:in `block in devise_for'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/rails/routes.rb:207:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bundler/gems/devise
-3c519b13ff94/lib/devise/rails/routes.rb:207:in `devise_for'
        from C:/Sites/blogbar/config/routes.rb:3:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-4.0
.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-4.0
.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-4.0
.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
        from C:/Sites/blogbar/config/routes.rb:1:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:222:in `load'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:222:in `load'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/application/routes_reloader.rb:40:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/application/routes_reloader.rb:40:in `load_paths'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/application/routes_reloader.rb:16:in `reload!'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/application/routes_reloader.rb:26:in `block in updater'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/application/routes_reloader.rb:27:in `updater'
        from C:65535:in `execute_if_updated'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/initializable.rb:30:in `instance_exec'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/initializable.rb:30:in `run'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/initializable.rb:55:in `block in run_initializers'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:150:in `block i
n tsort_each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:183:in `block (
2 levels) in each_strongly_connected_component'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:219:in `each_st
rongly_connected_component_from'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:182:in `block i
n each_strongly_connected_component'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:180:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:180:in `each_st
rongly_connected_component'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:148:in `tsort_e
ach'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/initializable.rb:54:in `run_initializers'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/application.rb:215:in `initialize!'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from C:/Sites/blogbar/config/environment.rb:5:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-
4.0.0/lib/active_support/dependencies.rb:228:in `require'
        from C:/Sites/blogbar/config.ru:3:in `block in <main>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/builder.rb:55:in `instance_eval'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/builder.rb:55:in `initialize'
        from C:/Sites/blogbar/config.ru:in `new'
        from C:/Sites/blogbar/config.ru:in `<main>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/builder.rb:49:in `eval'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/builder.rb:49:in `new_from_string'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/builder.rb:40:in `parse_file'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/server.rb:277:in `build_app_and_options_from_config'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/server.rb:199:in `app'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands/server.rb:48:in `app'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib
/rack/server.rb:314:in `wrapped_app'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands/server.rb:75:in `start'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:78:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:73:in `tap'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0
/lib/rails/commands.rb:73:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'


推荐答案

看起来没有安装'bcrypt_ext'gem。
添加此宝石并执行

Looks like 'bcrypt_ext' gem is not installed. Add this gem and\or do

bundle install

这篇关于生成模型后,Ruby gem devise错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆