undefined method `environment' for nil:NilClass when importing Bootstrap into rails

后端 未结 2 1181
無奈伤痛
無奈伤痛 2021-02-01 15:49

Getting error:

undefined method `environment\' for nil:NilClass
Extracted source (around line #5):


  Dossiyadata
  <%         


        
相关标签:
2条回答
  • 2021-02-01 16:17

    I also met that exact same error after I upgraded rails from 4.0.3 to 4.0.4.

    To solve solve this problem, only add

    gem "sass-rails", "~> 4.0.2"
    

    to your Gemfile and then

    bundle install
    

    Finally restart rails server

    Then enjoy your programming in rails 4.0.4

    0 讨论(0)
  • 2021-02-01 16:21

    When upgrading to Rails 4.0.5 you need to temporarily lock your sprockets at 2.11.x:

    gem 'sprockets', '<= 2.11.0'
    

    Then

    bundle install
    

    The exact error I was getting was:

    ActionView::Template::Error: undefined method `environment' for nil:NilClass
    

    For more context:

    https://github.com/rails/sass-rails/issues/191

    https://github.com/sstephenson/sprockets/issues/537

    0 讨论(0)
提交回复
热议问题