7

I'm trying to use the twitter-bootstrap-rails gem on my first Rails project, on a Windows 7 machine running

ruby 1.9.3p125 (2012-02-16) [i386-mingw32]
Rails 3.2.1
twitter-bootstrap-rails 2.1.1

When I run rails g bootstrap:install I get the following:

[WARNING] Please install gem 'therubyracer' to use Less.
    C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.5/lib/bundler/runtime.rb:74:in `require': cannot load such file -- twitter/bootstrap/rails (LoadError)
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.1.5/lib/bundler/runtime.rb:74:in 'rescue in block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.1.5/lib/bundler/runtime.rb:62:in 'block in require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.1.5/lib/bundler/runtime.rb:55:in 'each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.1.5/lib/bundler/runtime.rb:55:in 'require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-.1.5/lib/bundler.rb:119:in `require'
        from H:/Dev/sugarcane/config/application.rb:7:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:24:in `require'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1/lib/rails/commands.rb:24:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

Here's my Gemfile:

source 'https://rubygems.org'
gem 'rails', '3.2.1'
gem 'pg'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

I've tried including gem therubyracer in my Gemfile, but I get compilation errors about the libv8 gem, which isn't available on Windows. I've also tried gem therubyracer, :platform => :ruby, but Bundler still attempts to install therubyracer on bundle install. I also tried installing node.js and including gem execjs, but to no avail.

Every solution I come across doesn't seem to help at all. I'd like to use LESS rather than static CSS on this project, so a solution to allow me to use LESS with Rails on a Windows machine would be most helpful.

Community
  • 1
  • 1
liamja
  • 320
  • 3
  • 10
  • Did you try `gem install twitter-bootstrap-rails --ignore-dependencies` and lean on execjs? – waldyr.ar Jul 28 '12 at 18:49
  • @waldyr.ar Tried running that and it hasn't seemed to make a difference. I still get the `[warning]` with the generator. – liamja Jul 28 '12 at 18:55
  • I had same problem in OSX, not sure how I solved it but I think a C compiler helped. Do you have one? And also the lib8 gem – Ismael Abreu Jul 28 '12 at 20:19
  • @ismaelga Not currently, no. Reading about the libv8 gem, it seems it requires Python, which I have installed and referenced in my path, but also seems like it cannot be compiled on Windows. – liamja Jul 28 '12 at 20:33
  • Maybe the C compiler can make it work – Ismael Abreu Jul 28 '12 at 21:19

3 Answers3

7

I've switched to using the bootstrap-sass gem.

So instead of using LESS, I can use SASS as a CSS preprocessor. The downside is that it doesn't appear to have any code generators.

liamja
  • 320
  • 3
  • 10
1

According to this change branch of gem to static:

gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :branch => "static"

It solved problem for me.

zishe
  • 10,665
  • 12
  • 64
  • 103
  • 2
    Using the static branch, I was able to install the twitter-bootstrap-rail gem, but I'm still unable to get less to be compiled. `cannot load such file -- less (in bootstrap_and_overrides.css.less)` – liamja Jul 28 '12 at 19:58
  • I see. Soory, I missed the end. So I couldn't find a solution too:) – zishe Jul 28 '12 at 20:10
0

Please also look into your application Gemfile.

Make sure 'therubyracer' gem is included there.

So if you find line:

# gem 'therubyracer', platforms: :ruby

remove the hash like so:

gem 'therubyracer', platforms: :ruby

Aare
  • 1
  • 1