【问题标题】:Jekyll site fails only when pushed to GitHubJekyll 站点仅在推送到 GitHub 时才会失败
【发布时间】:2019-11-14 03:15:01
【问题描述】:

我正在使用 Jekyll 开发一个新版本的静态网站,通过 Github 页面部署:https://devcampy.com

存储库:https://github.com/gianarb/devcampy.com

我在本地使用 docker 运行它,但无法重现该问题:

$ docker run --rm -p 4000:4000 -v "$PWD":/srv/jekyll jekyll/jekyll:stable jekyll serve

这是我推送到存储库时通过电子邮件收到的错误。我不知道为什么它不能正常工作

The page build failed for the `master` branch with the following error:

Your SCSS file `assets/main.scss` has an error on line 6: File to import not found or unreadable: vendor/rfs. Load paths: node_modules /hoosegow/.bundle/ruby/2.5.0/gems/jekyll-theme-primer-0.5.3/_sass /hoosegow/.bundle/ruby/2.5.0/gems/jekyll-theme-primer-0.5.3/_sass /hoosegow/.bundle/ruby/2.5.0/gems/jekyll-theme-primer-0.5.3/_sass. For more information, see https://help.github.com/en/articles/page-build-failed-invalid-sass-or-scss.

有人有任何反馈吗?非常感谢

【问题讨论】:

    标签: ruby sass jekyll github-pages


    【解决方案1】:

    您当前的引导代码不完整。 /node_modules/bootstrap/scss/vendor/_rfs.scss 丢失,因为 .gitignore 规则阻止对任何 vendor 文件夹进行版本控制。

    1. 在您的 .gitignore 中,将 vendor 行替换为 vendor/bundle

    2. 运行npm install bootstrap 覆盖当前版本

    【讨论】:

    • 你无法想象我花了多少时间寻找和思考这个问题。谢谢
    【解决方案2】:

    错误说明了问题所在。你在 main.scss 中有这个就行了

    @import "bootstrap/scss/bootstrap";
    

    因此,这意味着该文件可能存在于本地,但由于它不存在,因此无法在您的部署中导入。

    查看您的存储库,我发现您的引导程序位于此处:

    node_modules/bootstrap/dist/css/bootstrap.min.css
    

    所以试试这个吧:

    @import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
    // or you could try
    @import "../node_modules/bootstrap/scss/bootstrap.scss"
    

    我认为其中一个应该可以工作。

    【讨论】:

    • 您好,不是导入问题。该文件存在并且 jekyll scss 插件管理基本路径,您可以在 _config.yaml github.com/gianarb/devcampy.com/blob/master/_config.yml#L12 中看到。我尝试了你的解决方案来仔细检查,我得到了同样的错误。它也没有解释为什么它在本地都能正常工作
    • 现在我知道我应该更频繁地使用这个命令git check-ignore *
    猜你喜欢
    • 2015-06-03
    • 2012-11-26
    • 1970-01-01
    • 1970-01-01
    • 2011-02-11
    • 1970-01-01
    • 1970-01-01
    • 2014-02-16
    • 1970-01-01
    相关资源
    最近更新 更多