警告在Windows上使用twitter-bootstrap-rails生成器

时间:2021-06-07 00:18:23

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

我正在尝试在运行的Windows 7机器上的第一个Rails项目中使用twitter-bootstrap-rails gem

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:

当我运行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>'

Here's my Gemfile:

这是我的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.

我已经尝试在我的Gemfile中包含gem therubyracer,但是我得到了关于libv8 gem的编译错误,这在Windows上是不可用的。我也试过gem therubyracer,:platform =>:ruby,但是Bundler仍然试图在bundle install上安装therubyracer。我也尝试过安装node.js并包含gem execjs,但无济于事。

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.

我遇到的每一个解决方案似乎都没有帮助。我想在这个项目中使用LESS而不是静态CSS,因此允许我在Windows机器上使用LESS和Rails的解决方案将是最有帮助的。

3 个解决方案

#1


7  

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

我已经切换到使用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.

因此,我可以使用SASS作为CSS预处理器,而不是使用LESS。缺点是它似乎没有任何代码生成器。

#2


1  

According to this change branch of gem to static:

根据gem的这个变化分支到静态:

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

It solved problem for me.

它解决了我的问题。

#3


0  

Please also look into your application Gemfile.

另请查看您的应用程序Gemfile。

Make sure 'therubyracer' gem is included there.

确保那里包含'therubyracer'宝石。

So if you find line:

所以,如果你找到行:

# gem 'therubyracer', platforms: :ruby

#gem'therubyracer',平台:: ruby

remove the hash like so:

像这样删除哈希:

gem 'therubyracer', platforms: :ruby

gem'therubyracer',平台:: ruby

#1


7  

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

我已经切换到使用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.

因此,我可以使用SASS作为CSS预处理器,而不是使用LESS。缺点是它似乎没有任何代码生成器。

#2


1  

According to this change branch of gem to static:

根据gem的这个变化分支到静态:

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

It solved problem for me.

它解决了我的问题。

#3


0  

Please also look into your application Gemfile.

另请查看您的应用程序Gemfile。

Make sure 'therubyracer' gem is included there.

确保那里包含'therubyracer'宝石。

So if you find line:

所以,如果你找到行:

# gem 'therubyracer', platforms: :ruby

#gem'therubyracer',平台:: ruby

remove the hash like so:

像这样删除哈希:

gem 'therubyracer', platforms: :ruby

gem'therubyracer',平台:: ruby