Warning using twitter-bootstrap-rails generators on Windows

怎甘沉沦 提交于 2019-12-05 22:44:47

问题


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.


回答1:


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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/11703686/warning-using-twitter-bootstrap-rails-generators-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!