我正尝试在我的第一个Rails项目中使用twitter-bootstrap-rails gem,在运行
ruby 1.9.3p125 (2012-02-16) [i386-mingw32]
Rails 3.2.1
twitter-bootstrap-rails 2.1.1当我运行rails g bootstrap:install时,我得到以下结果:
[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>'这是我的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'我尝试过在我的Gemfile中包含gem therubyracer,但是我得到了关于libv8 gem的编译错误,它是isn't available on Windows。我也尝试过gem therubyracer, :platform => :ruby,但是Bundler仍然试图在bundle install上安装therubyracer。我还尝试了安装node.js和gem execjs,但都无济于事。
我遇到的每一个解决方案似乎都没有任何帮助。我想在这个项目中使用LESS而不是静态CSS,所以在Windows机器上使用LESS和Rails的解决方案将是最有帮助的。
发布于 2012-07-29 19:56:40
我已经改用bootstrap-sass gem了。
因此,我可以使用SASS作为CSS预处理器,而不是使用LESS。缺点是它似乎没有任何代码生成器。
发布于 2012-07-29 03:03:27
根据this将gem的分支改为静态:
gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :branch => "static"它为我解决了问题。
发布于 2015-09-13 03:34:22
也请查看您的应用程序Gemfile。
确保'therubyracer‘的宝石包括在那里。
所以如果你找到下面这行:
gem 'therubyracer',platforms::ruby
删除散列,如下所示:
gem 'therubyracer',platforms::ruby
https://stackoverflow.com/questions/11703686
复制相似问题