【问题标题】:Jekyll's "--auto" doesn't work?Jekyll 的“--auto”不起作用?
【发布时间】:2013-03-23 19:15:35
【问题描述】:

我刚刚重新安装了整个系统并再次开始处理我的项目。我在其中一些中使用并仍在使用 Jekyll,但是我在使用 --auto_config.ymlauto: true 进行自动生成时遇到问题。它根本行不通。 jekyll --server --auto 的输出是:

Configuration from /home/rafal/Documents/Projects/ruby-adventure/_config.yml
Auto-regenerating enabled: /home/rafal/Documents/Projects/ruby-adventure -> /home/rafal/Documents/Projects/ruby-adventure/_site
[2013-03-23 19:09:53] regeneration: 1 files changed
[2013-03-23 19:09:53] INFO  WEBrick 1.3.1
[2013-03-23 19:09:53] INFO  ruby 2.0.0 (2013-02-24) [x86_64-linux]
[2013-03-23 19:09:53] WARN  TCPServer Error: Address already in use - bind(2)
[2013-03-23 19:09:53] INFO  WEBrick::HTTPServer#start: pid=3288 port=4000
[2013-03-23 19:09:53] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed
[2013-03-23 19:09:54] regeneration: 1 files changed

jekyll --no-auto --server 的输出是:

Configuration from /home/rafal/Documents/Projects/ruby-adventure/_config.yml
Building site: /home/rafal/Documents/Projects/ruby-adventure -> /home/rafal/Documents/Projects/ruby-adventure/_site
Successfully generated site: /home/rafal/Documents/Projects/ruby-adventure -> /home/rafal/Documents/Projects/ruby-adventure/_site
[2013-03-23 19:12:31] INFO  WEBrick 1.3.1
[2013-03-23 19:12:31] INFO  ruby 2.0.0 (2013-02-24) [x86_64-linux]
[2013-03-23 19:12:31] WARN  TCPServer Error: Address already in use - bind(2)
[2013-03-23 19:12:31] INFO  WEBrick::HTTPServer#start: pid=3327 port=4000

...所以没有错误弹出。该站点生成正常,但是当我更改文件时,它不会自动重新生成。任何想法为什么?

【问题讨论】:

  • 是的,可以重现。服务器有时需要在文件更改后重新启动,否则它不会接收更改。在 GitHub 项目页面上提交错误。
  • 您使用的是哪个 Jekyll 版本? 0.12.1?我使用它并且它工作正常,即它在您编辑和保存正在观看的文件后重新生成。 jekyll --no-auto --server 的结果不应包含 regenation: 1 files changed 语句。
  • 在 0.12.1 中遇到同样的问题。非常奇怪的是,每当我保存_config.yml 时,它会突然拾取在其他任何地方所做的所有更改并按应有的方式重新生成文件。有人和你一样吗?

标签: jekyll


【解决方案1】:

似乎是由最近对 directory_watcher gem 的更改引起的。回滚 gem 为我解决了这个问题:

sudo gem uninstall directory_watcher && sudo gem install directory_watcher -v 1.4.1

【讨论】:

  • 是的,也为我修好了。谢谢!
  • 这行得通,但现在它无休止地循环“5 个文件已更改”而没有任何文件保存。想法?
  • @JoelGrannas install v1.0.0.beta4 应该修复了!
  • 这是我的解决方案,除了我必须从该命令中删除sudos。否则,在尝试卸载时,我收到消息 INFO: gem "directory_watcher" is not installed。这可能与我的GEM_HOME/usr/local/ 的脸有关
  • 使用RVM的朋友别忘了去掉sudo:gem uninstall directory_watcher && gem install directory_watcher -v 1.4.1这两个(我觉得像@Jian)
【解决方案2】:

我可以通过按照@lilakai 对 directory_watcher gem 进行硬锁定来解决此问题,但我采用了不同的方式:

将此行添加到我的 gemfile(在开发组中):

gem 'directory_watcher', '1.4'

然后跑了:

bundle update directory_watcher

我这样做后一切正常(因为它将我的版本锁定为 1.4,我通过 Gemfile.lock 确认了这一点)。我更喜欢直接通过 bundler 管理我的所有 gem,而不是通过系统 ruby​​。

在发布本文时,我使用最新版本的 Octopress (https://github.com/imathis/octopress) 遇到了这个问题。

【讨论】:

  • 上帝感谢您发布这个刚刚修复了我的 rake watch 循环错误。我将我的 directory_watcher 设置为 1.4.4
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-02-07
  • 2020-07-17
  • 1970-01-01
  • 2015-12-21
  • 2016-04-02
  • 2019-01-27
  • 1970-01-01
相关资源
最近更新 更多