gpt4 book ai didi

ruby-on-rails - Rails railties gem 错误 "undefined method: ' less'"

转载 作者:行者123 更新时间:2023-12-04 00:06:07 29 4
gpt4 key购买 nike

我最近刚刚用 gem update 更新了我的 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:in method_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 的错误吗?我还在学习,所以我该如何解决这个问题?任何帮助都很棒。

最佳答案

twitter Bootstrap gem 依赖于 less gem。来自 the docs :

gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"
我个人发现 twitter bootstrap 从 official site 转储文件更容易。进入供应商/ Assets 目录。从 gem 更新比手动更新要容易一些,但是在更新 Bootstrap 时,您有点想“手动”进行更新,并“通过眼睛”检查所有内容 - 我更喜欢额外的努力,以确保它不会得到轻而易举地完成。此外,如果没有(据我所知)“未指定”样式,很难从 gem 中删除某些(例如)响应部分。响应式的东西会随着版本的变化而变化,就大小而言,所以你不能仅仅依靠它来工作。我真的看不出使用 gem 有什么好处。
更新
现在有一个官方 gem,我建议查看: https://github.com/twbs/bootstrap-sass

关于ruby-on-rails - Rails railties gem 错误 "undefined method: ' less'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13284077/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com