名称错误,未初始化的常量TurboDevAssets(NameError)

时间:2016-07-02 16:22:43

标签: ruby-on-rails ruby web-config

我正在学习rails。我从https://github.com/diaspora/diaspora下载代码,但无法运行。这是错误代码:

 /home/a1/.rvm/rubies/ruby-          2.1.7/web/diaspora/config/environments/development.rb:42:in `block in <top (required)>': uninitialized constant TurboDevAssets (NameError)
    from /home/a1/.rvm/gems/ruby-2.1.7/gems/railties-4.2.6/lib/rails/railtie.rb:210:in `instance_eval'
    from /home/a1/.rvm/gems/ruby-2.1.7/gems/railties-4.2.6/lib/rails/railtie.rb:210:in `configure'
    from /home/a1/.rvm/gems/ruby-2.1.7/gems/railties-4.2.6/lib/rails/railtie.rb:182:in `configure'
    from /home/a1/.rvm/rubies/ruby-2.1.7/web/diaspora/config/environments/development.rb:1:in `<top (required)>'

config / environments / development.rb是

    Diaspora::Application.configure do
     ....
      # Speed up asset serving
      config.middleware.insert 0, TurboDevAssets
    end

如何解决问题?

2 个答案:

答案 0 :(得分:1)

打开您的Gemfile并确保该行在那里:

  gem "turbo_dev_assets", "0.0.2"

如果是,但是你得到了那个错误,那么在条件之外移动那一行,或者你知道它会在你运行命令时被拾取的一个条件部分:

RAILS_ENV=development bin/bundle install --deployment --with "development test postgresql"

然后在该命令的输出中验证您是否看到此行:

Installing turbo_dev_assets 0.0.2

这应解决错误:

Name error ,uninitialized constant TurboDevAssets (NameError)

答案 1 :(得分:0)

您必须运行bundle install。

TurboDevAssets是gemfile中的一个gem:

  gem "turbo_dev_assets", "0.0.2"

捆绑安装将设置它。