load_missing_constant(NameError)

时间:2018-07-31 09:38:15

标签: ruby-on-rails ruby linux docker

系统详细信息:
-Linux
-Docker版本17.03.0-ce
-Ruby版本1.8.7
-Rails版本2.3.8。

在Docker上Ruby on Rails应用程序的过程中,我在运行脚本/服务器时遇到以下错误,即启动Rails的内置Web服务器:

  

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant':未初始化的常量Api :: InjectTokenIntoCookies(NameError )

此特定文件(InjectTokenIntoCookies)存在于单独的Plugins文件夹中。我所能解决的最远的问题是缺少宝石。但是,在docker容器中设置整个rails环境只会增加复杂性。

Docker文件中包含“ RUN bundle install”,所以这不应该成为问题。

完整错误跟踪:

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Api::InjectTokenIntoCookies (NameError)
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing'
    from /bab/apps/site/config/initializers/api_middleware.rb:1
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:145:in `load'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:622:in `load_application_initializers'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:621:in `each'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:621:in `load_application_initializers'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:176:in `process'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `run'
    from /bab/apps/site/config/environment.rb:6
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `gem_original_require'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:84
    from /bab/apps/site/script/server:3:in `gem_original_require'
    from /bab/apps/site/script/server:3:in `require'
    from /bab/apps/site/script/server:3

0 个答案:

没有答案