Jekyll 站点仅在推送到 GitHub 时失败

Jekyll site fails only when pushed to GitHub

我正在使用 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.

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

错误说明了问题所在。你在 main.scss

的线上有这个
@import "bootstrap/scss/bootstrap";

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

查看您的存储库,我发现您 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"

我认为其中之一应该有效。

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

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

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