对所有人来说,这是一个非常愉快和繁荣的新年。
我已经开始学习ROR并试图用它创建我的第一个应用程序。我正在尝试使用Twitter bootstrap gem。捆绑安装后,当我尝试运行rails server命令时,我收到此错误:
/var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/engine.rb:3:in `require': /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb:33: syntax error, unexpected ':', expecting kEND (SyntaxError)
有人可以指导我在这里缺少什么吗?
这是相同的堆栈跟踪:
/var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/engine.rb:3:in `require': /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb:33: syntax error, unexpected ':', expecting kEND (SyntaxError)
I18n.t name, scope: scope
^
from /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter/bootstrap/rails/engine.rb:3
from /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter-bootstrap-rails.rb:4:in `require'
from /var/lib/gems/1.8/gems/twitter-bootstrap-rails-2.1.9/lib/twitter-bootstrap-rails.rb:4
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
from /var/lib/gems/1.8/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
from /var/www/ahex_connect/config/application.rb:7
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:53:in `require'
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:53
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:50:in `tap'
from /var/lib/gems/1.8/gems/railties-3.2.9/lib/rails/commands.rb:50
from script/rails:6:in `require'
from script/rails:6
答案 0 :(得分:3)
问题是你正在使用Ruby 1.8,而第33行({{1}} gem内部)的语法来自Ruby 1.9。他们已修复此问题,使其与twitter-bootstrap-rails
兼容。所以可能的解决方案:
使用gem的git版本。将其添加到Gemfile(修改现有行)并运行master
gem'twitter-bootstrap-rails',:git => 'git的://github.com/seyhunak/twitter-bootstrap-rails.git'