1
的Rails似乎沒有被加載雷寶石,因爲我開始了開發服務器時得到一個Uninitialized constant
錯誤:Rails 3中沒有加載寶石
/home/my_app/config/initializers/kaminari_config.rb:1:in `<top (required)>': uninitialized constant Kaminari (NameError)
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:587:in `each'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:587:in `block in <class:Engine>'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
from /home/ramses/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/my_app/config/environment.rb:5:in `<top (required)>'
不過,我包括它Gemfile,並且正在運行gem list
也顯示它已安裝。有任何想法嗎?我該如何追蹤這個Uninitialized constant
錯誤?
謝謝!
我的Gemfile: 源 'https://rubygems.org'
gem 'rails', '3.2.1'
gem 'jquery-rails'
gem 'blueprint-rails'
gem 'mysql2'
gem 'kaminari'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem "therubyracer", :require => 'v8'
gem 'uglifier', '>= 1.0.3'
end
group :development do
gem 'rvm-capistrano'
gem 'capistrano'
end
我gem list
$ gem list
actionmailer (3.2.1)
actionpack (3.2.2, 3.2.1)
activemodel (3.2.2, 3.2.1)
activerecord (3.2.1)
activeresource (3.2.1)
activesupport (3.2.2, 3.2.1)
arel (3.0.0)
blueprint-rails (0.1.2)
builder (3.0.0)
bundler (1.0.22 ruby, 1.0.21)
capistrano (2.12.0)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.2.0)
daemon_controller (1.0.0)
erubis (2.7.0)
execjs (1.3.0)
fastthread (1.0.7)
highline (1.6.12)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.1)
jquery-rails (2.0.0)
jruby-jars (1.6.7)
jruby-rack (1.1.4)
json (1.6.5)
kaminari (0.13.0)
libv8 (3.3.10.4 x86-linux)
mail (2.4.1)
mime-types (1.17.2)
multi_json (1.0.4)
mysql2 (0.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.3.0)
net-ssh-gateway (1.1.0)
passenger (3.0.11)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1)
railties (3.2.1)
rake (0.9.2.2)
rdoc (3.12)
rubyzip (0.9.6.1)
rvm (1.11.3.3)
rvm-capistrano (1.1.0)
sass (3.1.14)
sass-rails (3.2.4)
sprockets (2.1.2)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
uglifier (1.2.3)
嗨凱文,根據你的建議,我跑了'rvm 1.9.2-p290 do gem list',並且在那裏顯示了kaminari。另外,運行'bundle install'也會顯示它已安裝 – Ramses
你可以運行'bundle exec rails c'嗎? –
不,它會拋出相同的錯誤'未初始化常量Kaminari(NameError)' – Ramses