2012-06-04 9 views
5

ich zuerst twitter Bootstrap-Anwendung erschaffe aber in Schienen 3.2.3 und Rubin 1.8.7Die Methode kann nicht 'charAt' undefinierter Fehler in Twitter Bootstrap nennen

ActionView::Template::Error (Cannot call method 'charAt' of undefined 
    (in /home/likewise-open/RADIXLOCAL/urjit.rajgor/workspace/twitter_bootstrap/app/assets/stylesheets/bootstrap_and_overrides.css.less)): 
    11:  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script> 
    12:  <![endif]--> 
    13: 
    14:  <%= stylesheet_link_tag "application" %> 
    15: 
    16:  <link href="images/favicon.ico" rel="shortcut icon"> 
    17:  <link href="images/apple-touch-icon.png" rel="apple-touch-icon"> 
    app/views/layouts/application.html.erb:14:in `_app_views_layouts_application_html_erb__1043627680__634423168' 
    app/controllers/posts_controller.rb:7:in `index' 

Mein Gemfile


folgende Störung zu erhalten
source 'https://rubygems.org' 

gem 'rails', '3.2.3' 
# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

gem 'mysql2' 
gem "execjs" 
gem 'json' 
# Gems used only for assets and not required 
# in production environments by default. 
gem "twitter-bootstrap-rails", :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git' 
group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 
    gem 'less-rails' 
    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    gem 'therubyracer', :platform => :ruby 
    gem 'uglifier', '>= 1.0.3' 

end 
gem 'jquery-rails' 

application.css


/* 
* This is a manifest file that'll automatically include all the stylesheets available in this directory 
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at 
* the top of the compiled file, but it's generally better to create a new file per style scope. 
*= require_self 
*= require bootstrap_and_overrides 
*= require_tree 
*/ 

bootstrap_and_overrides.css.less


@import "twitter/bootstrap/bootstrap"; 
body { padding-top: 60px; } 

@import "twitter/bootstrap/responsive"; 

// Set the correct sprite paths 
@iconSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings.png'); 
@iconWhiteSpritePath: asset-path('twitter/bootstrap/glyphicons-halflings-white.png'); 

// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines) 
@fontAwesomeEotPath: asset-path('fontawesome-webfont.eot'); 
@fontAwesomeWoffPath: asset-path('fontawesome-webfont.woff'); 
@fontAwesomeTtfPath: asset-path('fontawesome-webfont.ttf'); 
@fontAwesomeSvgzPath: asset-path('fontawesome-webfont.svgz'); 
@fontAwesomeSvgPath: asset-path('fontawesome-webfont.svg'); 

// Font Awesome 
@import "fontawesome"; 

mir Hilfe.
Danke.

+2

Ich glaube, Sie könnte dieses Problem lösen, indem Sie Ruby 1.9.x verwenden, aber wenn Sie 1.8.7 verwenden möchten - verwenden Sie statische Bootstrap-Stylesheets, ohne weniger und twitter-bootstrap gem. – taro

+0

Zum @taro Kommentar hinzufügen: http://guides.rubyonrails.org/3_2_release_notes.html#rails--3-2-requires-at-least-ruby-1-8-7 Natürlich können Sie nicht auf Ruby 1.9 upgraden .4? –

Antwort

1

Aktualisierung auf Ruby 1.9.3 behebt es.

0

Stellen Sie sicher, dass Sie keine ungültige LESS-Syntax haben. In meinem Fall hatte ich mehrere Dateien mit zusätzlichen Semikolons nach einer Beendigung geschweifte Klammer: selector { color:white; };

ich das Sublime Text 2 WENIGER Syntax-Highlighter bemerkt haben, werden diese kleinen Edelsteine ​​für Sie gelegentlich einfügen;)