41

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.

Prakash Murthy
  • 12,923
  • 3
  • 46
  • 74
Nicolas Brown
  • 1,546
  • 1
  • 10
  • 17

5 Answers5

89

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

Helio Santos
  • 6,606
  • 3
  • 25
  • 31
  • 3
    This is the gem that i am using currently, however i dont have the gem therubyracer or less-rails – Nicolas Brown Dec 15 '12 at 01:27
  • I guess that's it... I've followed the guide on the link and it worked fine. Like I've said, rails uses SASS instead of LESS. That's why the other two gems are required. (I am using rails 3) – Helio Santos Dec 15 '12 at 01:40
27

I simply needed to restart my server.

I had added the three gems listed above (less-rails, therubyracer, and twitter-bootstrap-rails, with Rails 3.2.13) while my local server was running, resulting in the problem seen above. So once I shut it down and restarted it again, everything loaded well.

AdrieanKhisbe
  • 3,899
  • 8
  • 37
  • 45
CodeBiker
  • 2,985
  • 2
  • 33
  • 36
7

You have to either update therubyracer or downgrade the twitter-bootstrap-rails gem down to version 2.1.7 which is the last known version that didn't have this issue.

Run either bundle update to update your gems or in your Gemfile make your twitter-bootstrap-rails gem look like this:

gem 'twitter-bootstrap-rails', '2.1.7'

Take a look at this issue:

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

This issue started happening on versions after 2.1.7 on twitter-bootstrap-rails.

MarsAtomic
  • 10,436
  • 5
  • 35
  • 56
Leo Correa
  • 19,131
  • 2
  • 53
  • 71
  • 2
    I try to install libv8 but it keeps failing, and the therubyracer depends on it, and also the "less" depends on the "therubyracer" – Nicolas Brown Dec 15 '12 at 01:37
  • @NicolasBrown try uninstalling and re-installing... ``gem uninstall libv8`` then ``bundle install`` will detect the dependency of therubyracer and will install libv8. And restart your server, as was mentioned in another post. – s2t2 Aug 27 '13 at 22:33
4

If you are getting it under Windows this should help you therubyracer_for_windows

It helped me

w_g
  • 164
  • 3
1

perhaps you are on windows ... there is no libv8 for windows and no binary therubyracer because it depends on libv8

Bernhard Zürn
  • 584
  • 6
  • 11