Jekyll无法在main.scss中找到包含的文件,或者该文件有错误

时间:2018-07-26 18:45:32

标签: jekyll github-pages jekyll-bootstrap

每次将相同的错误导入Jekyllrb时,我都会将开源CSS导入

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

我尝试在本地安装github页面进行测试,引入CSS而不是导入它,但它似乎仍然与我认为的主题Minima冲突,并试图读取scss文件而不是_site中的css

这是我的gemlock文件:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.10)
      actionpack (= 4.2.10)
      actionview (= 4.2.10)
      activejob (= 4.2.10)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.10)
      actionview (= 4.2.10)
      activesupport (= 4.2.10)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.10)
      activesupport (= 4.2.10)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (4.2.10)
      activesupport (= 4.2.10)
      globalid (>= 0.3.0)
    activemodel (4.2.10)
      activesupport (= 4.2.10)
      builder (~> 3.1)
    activerecord (4.2.10)
      activemodel (= 4.2.10)
      activesupport (= 4.2.10)
      arel (~> 6.0)
    activesupport (4.2.10)
      i18n (~> 0.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.5.2)
      public_suffix (>= 2.0.2, < 4.0)
    arel (6.0.4)
    autoprefixer-rails (9.0.0)
      execjs
    backports (3.11.3)
    bootstrap (4.0.0)
      autoprefixer-rails (>= 6.0.3)
      popper_js (>= 1.12.9, < 2)
      sass (>= 3.5.2)
    builder (3.2.3)
    colorator (1.1.0)
    concurrent-ruby (1.0.5)
    crass (1.0.4)
    em-websocket (0.5.1)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0.6.0)
    erubis (2.7.0)
    eventmachine (1.2.7)
    execjs (2.7.0)
    extras (0.3.0)
      forwardable-extended (~> 2.5)
    fastimage (2.1.3)
    ffi (1.9.25)
    forwardable-extended (2.6.0)
    globalid (0.4.1)
      activesupport (>= 4.2.0)
    hootstrap (0.4.0)
      bootstrap (~> 4.0.0)
      rails (>= 4.2.0)
      sass-rails
    http_parser.rb (0.6.0)
    i18n (0.9.5)
      concurrent-ruby (~> 1.0)
    jekyll (3.8.3)
      addressable (~> 2.4)
      colorator (~> 1.0)
      em-websocket (~> 0.5)
      i18n (~> 0.7)
      jekyll-sass-converter (~> 1.0)
      jekyll-watch (~> 2.0)
      kramdown (~> 1.14)
      liquid (~> 4.0)
      mercenary (~> 0.3.3)
      pathutil (~> 0.9)
      rouge (>= 1.7, < 4)
      safe_yaml (~> 1.0)
    jekyll-admin (0.8.1)
      addressable (~> 2.4)
      jekyll (~> 3.3)
      sinatra (~> 1.4)
      sinatra-contrib (~> 1.4)
    jekyll-archives (2.1.1)
      jekyll (>= 2.4)
    jekyll-assets (2.4.0)
      concurrent-ruby (~> 1.0)
      extras (~> 0.2)
      fastimage (~> 2.0, >= 1.8)
      jekyll (~> 3.1, >= 3.0)
      pathutil (>= 0.8)
      rack (~> 1.6)
      sprockets (~> 3.3, < 3.8)
    jekyll-compose (0.8.0)
      jekyll (~> 3.0)
    jekyll-feed (0.10.0)
      jekyll (~> 3.3)
    jekyll-sass-converter (1.5.2)
      sass (~> 3.4)
    jekyll-seo-tag (2.5.0)
      jekyll (~> 3.3)
    jekyll-watch (2.0.0)
      listen (~> 3.0)
    kramdown (1.17.0)
    liquid (4.0.0)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.2.2)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.0)
      mini_mime (>= 0.1.1)
    mercenary (0.3.6)
    mini_mime (1.0.0)
    mini_portile2 (2.3.0)
    minima (2.5.0)
      jekyll (~> 3.5)
      jekyll-feed (~> 0.9)
      jekyll-seo-tag (~> 2.1)
    minitest (5.11.3)
    multi_json (1.13.1)
    nokogiri (1.8.4)
      mini_portile2 (~> 2.3.0)
    pathutil (0.16.1)
      forwardable-extended (~> 2.6)
    popper_js (1.14.3)
    public_suffix (3.0.2)
    rack (1.6.10)
    rack-protection (1.5.5)
      rack
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.10)
      actionmailer (= 4.2.10)
      actionpack (= 4.2.10)
      actionview (= 4.2.10)
      activejob (= 4.2.10)
      activemodel (= 4.2.10)
      activerecord (= 4.2.10)
      activesupport (= 4.2.10)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.10)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.9)
      activesupport (>= 4.2.0, < 5.0)
      nokogiri (~> 1.6)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.4)
      loofah (~> 2.2, >= 2.2.2)
    railties (4.2.10)
      actionpack (= 4.2.10)
      activesupport (= 4.2.10)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.3.1)
    rb-fsevent (0.10.3)
    rb-inotify (0.9.10)
      ffi (>= 0.5.0, < 2)
    rouge (3.1.1)
    ruby_dep (1.5.0)
    safe_yaml (1.0.4)
    sass (3.5.7)
      sass-listen (~> 4.0.0)
    sass-listen (4.0.0)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    sass-rails (5.0.7)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sinatra (1.4.8)
      rack (~> 1.5)
      rack-protection (~> 1.4)
      tilt (>= 1.3, < 3)
    sinatra-contrib (1.4.7)
      backports (>= 2.0)
      multi_json
      rack-protection
      rack-test
      sinatra (~> 1.4.0)
      tilt (>= 1.3, < 3)
    sprockets (3.7.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.20.0)
    thread_safe (0.3.6)
    tilt (2.0.8)
    tzinfo (1.2.5)
      thread_safe (~> 0.1)

PLATFORMS
  ruby

DEPENDENCIES
  hootstrap
  jekyll (~> 3.8.2)
  jekyll-admin
  jekyll-archives
  jekyll-assets
  jekyll-compose
  jekyll-sass-converter
  minima (~> 2.0)
  tzinfo-data

BUNDLED WITH
   1.16.3

还有我的config.yml

sass:
  style: compact # possible values: nested expanded compact compressed

我的main.scss驻留在根文件夹中。就像它要包含/读取scss文件,而不是将其编译到_site / css

有时候,当我尝试更改一些无聊的内容时,我会收到此错误,这使我相信主题Minima也会使我陷入循环

Your SCSS file `main.scss` has an error on line 14: File to import not found or unreadable: bootstrap/functions. Load paths: _sass /hoosegow/.bundle/ruby/2.4.0/gems/jekyll-theme-primer-0.5.3/_sass

我不知道该怎么做才能正确编译并在github页面上工作。有想法吗?

1 个答案:

答案 0 :(得分:0)

错误是指您的import中有一个assets/main.scss语句,并且找不到 语句中引用的文件(或不可读)。

检查项目的根目录(不是_site目录),我认为您那里有一个_sass目录。如果是这样,请更新您的_config.yml文件以告诉Jekyll在哪里找到它。假设它在根目录中并且输出被压缩,请添加以下内容:

sass:
  sass_dir: _sass
  style: compressed

然后,如果本地Jekyll服务器正在运行,请停止它。删除_site目录并重建站点。

希望build或serve命令不再输出此错误。

如果问题仍然存在,请在问题中加入SCSS文件,并提供项目目录的屏幕快照,以及重建后的_site目录结构的屏幕快照。