简体   繁体   English

无法在本地服务器上打开Hartl的sample_app

[英]Can't open Hartl's sample_app on local server

I'm going trough Hartl's tutorial and everything was ok until 11th chapter. 我正在浏览Hartl的教程,一切正常,直到第11章。 I did everything in chapter 11 as was required(few times, maybe that is problem?) and suddenly I can't open app on local server. 我按要求完成了第11章中的所有操作(几次,也许是问题吗?),突然我无法在本地服务器上打开应用程序。 Problems begun when i was supposed to seed database, so I reset it and (unsuccessfully) seeded it few times. 当我应该为数据库播种时,问题就开始了,所以我将其重置并(几次失败)播种了几次。 Finally, i managed to seed db, but problem remained. 最终,我设法为db注入了种子,但是问题仍然存在。

This is what i get on local server but I don't know what are this arguments: 这是我在本地服务器上获得的信息,但我不知道这些参数是什么:

wrong number of arguments (2 for 1) for `asset-path' (in /home/aki/sample_app/app/assets/stylesheets/bootstrap_and_overrides.css.scss:1)

Extracted source (around line #1):

$iconSpritePath: asset-path('glyphicons-halflings.png', image);
$iconWhiteSpritePath: asset-url("glyphicons-halflings-white.png", image);

@import "bootstrap";

Rails.root: /home/aki/sample_app

Application Trace | Framework Trace | Full Trace
app/assets/stylesheets/bootstrap_and_overrides.css.scss:1
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___2752615510238668489_70204869722340'

If you need 'insight' in other files, I will post them, I don't know where is problem.. Please help :) 如果您需要其他文件中的“洞察力”,我会将其发布,我不知道问题出在哪里。请帮助:)

Understanding errors 了解错误

First of all, it's important that you learn to read & understand error messages properly: 首先,重要的是要学会正确阅读和理解错误消息:

wrong number of arguments (2 for 1) for `asset-path` (in 
/app/assets/stylesheets/bootstrap_and_overrides.css.scss:1)

This basically says, there are 2 arguments for the asset-path helper, but only 1 is expected. 基本上说, asset-path帮助程序有2个参数,但预期只有1个。 It does not know what to do with the second argument. 它不知道如何处理第二个参数。

It also shows where this error exists, giving you the exact path to the file with the error: bootstrap_and_overrides.css.scss 它还显示此错误的存在位置,并为您提供错误的文件的确切路径: bootstrap_and_overrides.css.scss

The error itself 错误本身

So after you learned that, you can open the file and change your code from: 因此,了解到这一点之后,您可以打开文件并从以下位置更改代码:

$iconSpritePath: asset-path('glyphicons-halflings.png', image);
$iconWhiteSpritePath: asset-url('glyphicons-halflings-white.png', image);

to: 至:

$iconSpritePath: asset-path('glyphicons-halflings.png');
$iconWhiteSpritePath: asset-url('glyphicons-halflings-white.png');

I simply removed the second argument, image . 我只是删除了第二个参数image The asset-path & asset-url helpers only take one single argument, as stated in the error and described in their docs . asset-pathasset-url助手只需要一个单一的参数,如错误陈述,并在他们的文档中描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM