Warning using twitter-bootstrap-rails generators on Windows
Asked Answered
E

3

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.

Escalator answered 28/7, 2012 at 18:41 Comment(5)
Did you try gem install twitter-bootstrap-rails --ignore-dependencies and lean on execjs?Orling
@Orling Tried running that and it hasn't seemed to make a difference. I still get the [warning] with the generator.Escalator
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 gemAliquot
@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.Escalator
Maybe the C compiler can make it workAliquot
E
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.

Escalator answered 29/7, 2012 at 11:56 Comment(0)
A
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.

Avast answered 28/7, 2012 at 19:3 Comment(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)Escalator
I see. Soory, I missed the end. So I couldn't find a solution too:)Avast
H
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

Heathenism answered 12/9, 2015 at 19:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.