2017-05-02 134 views
1

我正在嘗試使用rails和bootstrap-sass創建一個webapp。
我安裝了那些從Ruby On Rails With Bootstrap Tutorial (simple),它的工作指令。在紅寶石軌道上安裝bootstrap-sass後出現錯誤

安裝bootstrap-sass gem並嘗試在瀏覽器中打開我的應用程序後,ruby/rails會給我一個錯誤消息。

Showing C:/Sites/bopp/app/views/layouts/application.html.erb where line #7 raised: TypeError: Das Objekt unterstützt diese Eigenschaft oder Methode nicht.>

條目:

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 

根據Ruby on Rails Application coult not include stylesheet nor js我改變了它,並得到了另一個錯誤:

Showing C:/Sites/bopp/app/views/layouts/application.html.erb where line #7 raised: The asset "default.css" is not present in the asset pipeline.

條目:

<%= stylesheet_link_tag "default", media: "all", "data-turbolinks-track" => true %> 
<%= javascript_include_tag "default", "data-turbolinks-track" => true %> 

我改變application.css到APPLI cation.css.scss。 條目:

/* 
* This is a manifest file that'll be compiled into application.css, which will include all the files 
* 
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's 
* vendor/assets/stylesheets directory can be referenced here using a relative path. 
* It is generally better to create a new file per style scope. 
* 
*= require_tree . 
*= require_self 
*/ 
@import 'bootstrap-sprockets'; 
@import 'bootstrap'; 

只有一個變化的Gemfile:

gem 'bootstrap-sass' 

我改變而已。然後我跑bundle install

紅寶石版本:2.3.3
Rails的版本:5.1.0(從http://railsinstaller.org/en下載)
操作系統:Windows 7
編輯:崇高文本2
瀏覽器:Mozilla Firefox瀏覽器

+0

也許一些關於與第一條消息的詳細信息「對象不支持此屬性或方法」。也許文件的名稱應該是layouts/application.html.erb,特別是第7行? – Jake

回答

0

如果我讀這正確地你需要改變默認爲應用程序。

<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> 
<%= javascript_include_tag "application", "data-turbolinks-track" => true %> 

它正在尋找一個default.css文件,但應該查找您的application.css文件或您的application.js文件。通過改變你的第一個問題,你造成了第二個問題。

+0

Thx爲您的答案, 如果我將「默認」改回「應用程序」(這是標準條目),我得到第一個錯誤消息。正如我所提到的,我將它更改爲「默認」,因爲我在本網站的其他答案中找到了它。 第一個錯誤消息是關於屬性和方法的,第二個是關於asset.css的。所以,我不知道該怎麼做。 –