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

Can't open Hartl's sample_app on local server

我正在学习 Hartl 的教程,在第 11 章之前一切正常。我按照要求做了第 11 章中的所有事情(几次,也许这是问题?),突然我无法在本地服务器上打开应用程序。 当我应该为数据库播种时问题就开始了,所以我重置了它并(不成功地)为它播种了几次。最后,我设法种子数据库,但问题仍然存在。

这是我在本地服务器上得到的,但我不知道这是什么参数:

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'

如果你在其他文件中需要'insight',我会post他们,我不知道哪里有问题..请帮助:)

理解错误

首先,学会正确阅读和理解错误消息很重要:

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

这基本上是说,asset-path 助手有 2 个参数,但预期只有 1 个。它不知道如何处理第二个参数。

它还会显示此错误存在的位置,为您提供错误文件的确切路径:bootstrap_and_overrides.css.scss

错误本身

所以在你了解之后,你可以打开文件并更改你的代码:

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

至:

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

我只是删除了第二个参数,imageasset-path & asset-url 助手只接受一个 单个 参数,如错误和 described in their docs.

中所述