0

我最近安装了适用于 Linux 的 Windows 子系统,并且正在我的 Windows 10 计算机上运行 Ubuntu 发行版。我安装了 Python、pip、Ruby 和 Jekyll,当我运行 --version 标志时,它们都被确认安装正确。

我正在尝试在我的计算机上本地运行和修改一个名为Mediumish的 Jekyll 主题。按照作者的说明(即 runbundle和 run jekyll serve --watch),我遇到以下错误:

Traceback (most recent call last):
        5: from /usr/local/bin/jekyll:23:in `<main>'
        4: from /usr/local/bin/jekyll:23:in `load'
        3: from /var/lib/gems/2.5.0/gems/jekyll-3.8.6/exe/jekyll:11:in `<top (required)>'
        2: from /var/lib/gems/2.5.0/gems/jekyll-3.8.6/lib/jekyll/plugin_manager.rb:48:in `require_from_bundler'
        1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler (LoadError)

我已经尝试向作者的 Github 帐户提交问题,但似乎他已经停止回复(和维护)这个主题几个月了。

我发现另一个 Stackoverflow 帖子,标题为Ruby/Jekyll 在运行 -watch 时出现未知错误——这与我遇到的情况非常相似。我已经尝试了这篇文章中推荐的解决方案,这些解决方案是运行jekyll build --watchandjekyll serve --watch命令,但是会出现同样的错误。

几个月前我能够成功运行这个主题,但是在重新格式化我的电脑,从头开始重新安装我所有的应用程序,并从作者的网站克隆一个新的主题副本后,我无法在本地服务该网站,从而阻碍了我查看我对博客主题所做的任何修改。

4

1 回答 1

1

我运行了这个gem update --system命令,我的 Jekyll 主题几乎在本地服务。

我收到以下错误:

Error: could not read file /mnt/c/Users/muyga/Desktop/mediumish-theme-jekyll/vendor/bundle/gems/jekyll-3.8.5/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb: Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/bundle/gems/jekyll-3.8.5/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter. ERROR: YOUR SITE COULD NOT BE BUILT: ------------------------------------ Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/bundle/gems/jekyll-3.8.5/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.

为了修复该错误,我修改了我的config.yml文件并添加vendorexclude:类别中以在我的主题文件夹中排除该文件夹。

现在,当我运行主题时bundle exec jekyll serve --watch,主题服务正常。

感谢@JayDorsey 和Jekyll:错误:无法建立站点, 解决方案的日期格式错误!

于 2019-07-31T22:33:40.210 回答