gpt4 book ai didi

ruby-on-rails - 为什么在运行 webrick 服务器时出现未初始化常量设计名称错误?

转载 作者:数据小太阳 更新时间:2023-10-29 06:37:16 24 4
gpt4 key购买 nike

在我的应用程序中,我使用了 ruby​​ 1.9.2 和 rails 3.0.3,并且还安装了 Devise gem。当我运行 Webrick 服务器时,问题就开始了,我得到了未初始化的常量 Devise 名称错误。

       /home/app/Workspace/project/Library_Management/Library_Management/config/initializers/devise.rb:3:in `<top (required)>': uninitialized constant Devise (NameError)
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/engine.rb:200:in `each'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/engine.rb:200:in `block in <class:Engine>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `instance_exec'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:25:in `run'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `each'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/initializable.rb:49:in `run_initializers'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/application.rb:134:in `initialize!'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/application.rb:77:in `method_missing'
from /home/app/Workspace/project/Library_Management/Library_Management/config/environment.rb:5:in `<top (required)>'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:54:in `require'
from /home/app/Workspace/project/Library_Management/Library_Management/config.ru:3:in `block in <main>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /home/app/Workspace/project/Library_Management/Library_Management/config.ru:1:in `new'
from /home/app/Workspace/project/Library_Management/Library_Management/config.ru:1:in `<main>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/builder.rb:35:in `eval'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/builder.rb:35:in `parse_file'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/server.rb:162:in `app'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/server.rb:253:in `wrapped_app'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/server.rb:204:in `start'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/server.rb:65:in `start'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:27:in `tap'
from /home/app/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:27:in `<top (required)>'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:58:in `require'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:58:in `rescue in require'
from /home/app/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'

谢谢

最佳答案

检查你的 config/application.rb,你需要添加 require 'devise',你应该没问题。

关于ruby-on-rails - 为什么在运行 webrick 服务器时出现未初始化常量设计名称错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6551946/

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