--watch arg 在 Windows 上不受支持

--watch arg is unsupported on Windows

我是 jekyll 的新手,所以首先我按照本教程 Jekyll on Windows 并设置了 jekyll 3.3。0.I 在本教程中遇到了关于证书的错误 SSL 证书更新 并通过使用此 cacert.pem 证书解决了问题。 但是,当启动 jekyll 服务器时,我得到:

--watch arg is unsupported on Windows. If you are on Windows Bash, please see: https://github.com/Microsoft/BashOnWindows/issues/216

我尝试使用 Let Jekyll --watch 解决这个问题,但没有成功。 如果我使用 jekyll 3.2.1,一切正常,但 jekyll 3.3.0 有问题。 那么如何解决这个问题呢?

编辑

我解决了阅读 this 的问题,并在 C:\tools\ruby23\lib\ruby\gems.3.0\gems\jekyll-3.3.0\lib\jekyll\commandsbuild.rb 文件中注释了一些代码 启用自动再生,现在一切正常。

def watch(site, options)
          #if Utils::Platforms.windows?
          #  Jekyll.logger.warn "", "--watch arg is unsupported on Windows. "
          #  Jekyll.logger.warn "", "If you are on Windows Bash, please see: " \
          #     "https://github.com/Microsoft/BashOnWindows/issues/216"

         # else
            External.require_with_graceful_fail "jekyll-watch"
            watch_method = Jekyll::Watcher.method(:watch)
            if watch_method.parameters.size == 1
              watch_method.call(
                options
              )
            else
              watch_method.call(
                options, site
              )
           # end
          end

我想你可以直接输入 jekyll serve

是windowsbash错误,Jekyll或Windows会尽快修复,到时候你可以使用jekyll 3.2.1版本。

Here I commit my answer.

我通过安装 Ruby 2.3.3, DevKit-mingw64 和 jekyll 3.4.3

解决了这个问题