Ruby on Rails error "cannot load such file -- less"

Nicolas Brown picture Nicolas Brown · Dec 15, 2012 · Viewed 35k times · Source

I am fairly new to ruby on rails, I have been trying to use twitter-bootstrap as an asset, so I have included it in my Gemfile, bundled and it installs successfully. However I have noticed that it relies on certain dependencies that are not shown when I do the "bundle" command.

The dependences it needs

(1) Libv8
(2) Less
(3) Less-rails

Error message:

cannot load such file -- less
  (in c:/Sites/todo/app/assets/stylesheets/bootstrap_and_overrides.css.less)

[code]

Extracted source (around line #8):

5:   <!--[if lt IE 9]>
6:     <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"     type="text/javascript"></script>
7:   <![endif]-->
8:   <%= stylesheet_link_tag    "application", :media => "all" %>
9:   <%= javascript_include_tag "application" %>
10:   <%= csrf_meta_tags %>
11:   <meta name="viewport" content="width=device-width, initial-scale=1.0">

[/code]

Trace
app/views/layouts/application.html.erb:8:in     `_app_views_layouts_application_html_erb__560528188_27183396'
app/controllers/lists_controller.rb:7:in `index'

I have noticed a lot of answers to this very question already, and have chosen the obvious solutions, but somehow I still get stuck, and would really appreciate some guidance.

Answer

Helio Santos picture Helio Santos · Dec 15, 2012

I guess you are using sass instead of LESS.

Have you tried the twitter-bootstrap-rails gem?

gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"

https://github.com/seyhunak/twitter-bootstrap-rails