簡體   English   中英

在ruby rails上安裝bootstrap-sass后出現錯誤

[英]Errors after installing bootstrap-sass on ruby rails

我正在嘗試使用rails和bootstrap-sass創建一個webapp。
我安裝了Ruby On Rails With Bootstrap Tutorial(簡單)的說明 ,它可以工作。

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

顯示C:/Sites/bopp/app/views/layouts/application.html.erb第7行引發:TypeError:DasObjektunterstütztdieseEigenschaft oder Methode nicht。>

項:

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

根據Ruby on Rails應用程序,不包括stylesheet和js我更改了它,並得到另一個錯誤:

顯示C:/Sites/bopp/app/views/layouts/application.html.erb第7行引發:資產管道中不存在資產“default.css”。

項:

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

我將application.css更改為application.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

Ruby版本:2.3.3
Rails版本:5.1.0(從http://railsinstaller.org/en下載)
操作系統:Windows 7
編輯:Sublime Text 2
瀏覽器:Mozilla Firefox

如果我正確讀取此內容,則需要將默認值更改為應用程序。

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

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

我解決了這個問題。 我不得不刪除//= require_tree . 來自application.js

這里有一個答案:在此處輸入鏈接描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM