当前位置: 动力学知识库 > 问答 > 编程问答 >

ruby - Error "uninitialized constant Rails::Engine (NameError)"

问题描述:

I am trying to join a Rails project. This project uses rails 2.3.8 and Ruby 1.8.7 so I am using RVM. I am also using gem v1.3.7

When I fire up the server, everything is ok. But then, when I try to access it through my browser, it crashes and I get the following trace:

/Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Rails::Engine (NameError)

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/devise_invitable-0.3.6/lib/devise_invitable/rails.rb:2

from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'

from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/devise_invitable-0.3.6/lib/devise_invitable.rb:16

from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'

from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/rails/gem_dependency.rb:215:in `load'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:307:in `each'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:307:in `load_gems'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:169:in `process'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:113:in `send'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/initializer.rb:113:in `run'

from /Users/ca/Documents/Project/Sources/Project-test/config/environment.rb:9

from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'

from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'

from /Users/ca/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.8/lib/commands/server.rb:84

from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'

from /Users/ca/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

from ./script/server:3

Here are my installed gems:

actionmailer (2.3.8)

actionpack (2.3.8)

activemodel (3.0.5)

activerecord (2.3.8)

activeresource (2.3.8)

activesupport (3.0.5, 2.3.8)

addressable (2.2.4)

arel (2.0.9)

aws (2.4.4)

aws-s3 (0.6.2)

bcrypt-ruby (2.1.4)

builder (3.0.0, 2.1.2)

client_side_validations (2.9.9)

crack (0.1.8)

daemons (1.1.0)

dalli (1.0.2)

delayed_job (2.0.3)

devise (1.1.7)

devise_invitable (0.3.6)

faraday (0.5.7, 0.4.6)

fb_graph (1.5.3)

googlecharts (1.6.1)

http_connection (1.4.0)

httparty (0.7.4)

i18n (0.5.0)

json (1.5.1, 1.4.3)

mime-types (1.16)

multi_json (0.0.5)

multipart-post (1.1.0)

net-ldap (0.1.1)

nokogiri (1.4.4)

oa-basic (0.1.5)

oa-core (0.1.5)

oa-enterprise (0.1.5)

oa-oauth (0.1.5)

oa-openid (0.1.5)

oauth (0.4.4)

oauth2 (0.1.1, 0.0.13)

omniauth (0.1.5)

paperclip (2.3.8)

pyu-ruby-sasl (0.0.3.2)

rack (1.1.1)

rack-openid (1.1.2)

rails (2.3.8)

rake (0.8.7)

RedCloth (4.2.7)

rest-client (1.6.1)

ruby-openid (2.1.8)

ruby-openid-apps-discovery (1.2.0)

rubygems-update (1.3.7)

rubyntlm (0.1.1)

tzinfo (0.3.24)

uuidtools (2.1.2)

validates_timeliness (2.3.0)

validation_reflection (0.3.7)

validation_reflection-active_model (0.3.1)

warden (1.0.3)

will_paginate (2.3.15)

xml-simple (1.0.14)

Where does the problem come from?

Thank you very much for your help!

网友答案:

Your version of the DeviseInvitable is too new for Rails 2.3.

DeviseInvitable currently only support Rails 3, if you want to use it with Rails 2.3 you must install version 0.2.3

As is Devise 1.1

Support for Rails 2.3.x can be found by installing Devise 1.0.x from the v1.0 branch.

Run

gem uninstall devise devise_invitable
gem install devise --version 1.0.10
gem install devise_invitable --version 0.2.3
分享给朋友:
您可能感兴趣的文章:
随机阅读: