Search code examples
ruby-on-railsrubylessnomethoderror

undefined method `new' for #<Grease::Adapter(Less::Rails::ImportProcessor)


I have updated a gem in the Gemfile and started facing the Grease::Adapter error after running "bundle" command. The problem seems with the css of my application.

The error is given below:

NoMethodError: undefined method `new' for #<Grease::Adapter(Less::Rails::ImportProcessor):0x0000000205dfc0>

I am using rails version "4.1.8". Can anyone help me how to resolve this?


Solution

  • The issue was resolved and it was due to the "grease" gem dependency for updated "less-rails" gem (v3.0.0).

    "Grease" dependency was created when I updated an existing gem version in my Gemfile which updated the "less-rails" gem version from "2.8.0" to "3.0.0" in Gemfile.lock as well.

    Then I set the "less-rails" version to the old one (previously being used in Gemfile.lock):

    gem "less-rails", "~> 2.8.0"
    

    Grease gem dependency is required only for "less-rails" 3.0.0 version and above so lower version did not create this dependency which resolved the issue.

    Official page for less-rails(3.0.0) dependencies: https://rubygems.org/gems/less-rails/versions/3.0.0