12

我最近刚刚用gem updateand更新了我的 rails 应用程序的 gems bundle update。当我尝试用它进行测试时,rails s它给了我这个错误:

/Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/railtie/configuration.rb:85:inmethod_missing':未定义的方法less' for #<Rails::Application::Configuration:0x0000010308a300> (NoMethodError)

错误消息的其余部分如下所示:

from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/twitter-bootstrap-rails-2.1.6/lib/twitter/bootstrap/rails/engine.rb:15:in `block in <class:Engine>'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/Richard/Code/Rails/rgsimms/config/environment.rb:5:in `<top (required)>'
    from /Users/Richard/Code/Rails/rgsimms/config.ru:4:in `require'
    from /Users/Richard/Code/Rails/rgsimms/config.ru:4:in `block in <main>'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
    from /Users/Richard/Code/Rails/rgsimms/config.ru:1:in `new'
    from /Users/Richard/Code/Rails/rgsimms/config.ru:1:in `<main>'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

这是 Twitter Bootstrap gem 的错误吗?我还在学习,所以我该如何解决这个问题?任何帮助都很棒。

4

1 回答 1

34

twitter 引导 gem 依赖于 less gem。从文档

gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"

我个人发现 twitter bootstrap 将文件从官方站点转储到 vendor/assets 目录更容易。从 gem 更新比手动更新要容易一些,但是在更新引导程序时,您有点想“手动”进行更新,并“通过眼睛”检查所有内容 - 我更喜欢额外的努力,以确保它不会得到轻而易举地完成。此外,如果没有(据我所知)“未指定”样式,很难从 gem 中删除某些(例如)响应部分。响应式的东西会随着版本的变化而变化,就大小而言,所以你不能仅仅依靠它来工作。我真的看不出使用 gem 有什么好处。

更新

现在有一个官方 gem,我建议查看:https ://github.com/twbs/bootstrap-sass

于 2012-11-08T07:12:56.617 回答