[英]Errors after installing bootstrap-sass on ruby rails
I'm trying to create a webapp with rails and bootstrap-sass. 我正在尝试使用rails和bootstrap-sass创建一个webapp。
I installed those with instructions from Ruby On Rails With Bootstrap Tutorial (simple) , which works. 我安装了Ruby On Rails With Bootstrap Tutorial(简单)的说明 ,它可以工作。
After installing the bootstrap-sass gem, and trying to open my app in the browser, ruby/rails gets me an error msg. 安装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.>
显示C:/Sites/bopp/app/views/layouts/application.html.erb第7行引发:TypeError:DasObjektunterstütztdieseEigenschaft oder Methode nicht。>
Entries: 项:
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
According to Ruby on Rails Application coult not include stylesheet nor js I changed it, and got another error: 根据Ruby on Rails应用程序,不包括stylesheet和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.
显示C:/Sites/bopp/app/views/layouts/application.html.erb第7行引发:资产管道中不存在资产“default.css”。
Entries: 项:
<%= stylesheet_link_tag "default", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "default", "data-turbolinks-track" => true %>
I changed application.css to application.css.scss. 我将application.css更改为application.css.scss。 Entries:
项:
/*
* 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';
Only one change in Gemfile: Gemfile中只有一个更改:
gem 'bootstrap-sass'
I changed nothing else. 我什么都没改变。
Then I ran bundle install
. 然后我运行了
bundle install
。
Ruby Version: 2.3.3 Ruby版本:2.3.3
Rails Version: 5.1.0 (downloaded from http://railsinstaller.org/en ) Rails版本:5.1.0(从http://railsinstaller.org/en下载)
OS: Windows 7 操作系统:Windows 7
Editor: Sublime Text 2 编辑:Sublime Text 2
Browser: Mozilla Firefox 浏览器:Mozilla Firefox
If I am reading this correctly you need to change default to application. 如果我正确读取此内容,则需要将默认值更改为应用程序。
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
It is looking for a default.css file but should be looking for your application.css file or your application.js file. 它正在寻找default.css文件,但应该查找application.css文件或application.js文件。 By changing your first issue you caused your second one.
通过更改您的第一个问题,您导致了第二个问题。
I solved the problem. 我解决了这个问题。 I had to remove
//= require_tree .
我不得不删除
//= require_tree .
from application.js
来自
application.js
There is an answer here: enter link description here 这里有一个答案:在此处输入链接描述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.