-->

Ruby/Jekyll unknown error when running -watch

2020-07-30 05:43发布

问题:

I've just started playing around with Ruby and Jekyll and I've been using the -watch command from CLI to automatically update the Jekyll site. However after a brief computer restart I'm seeing the following error when running jekyll -watch

/Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.3/lib/mercenary/program.rb:30:in `go': invalid option: -watch (OptionParser::InvalidOption)
from /Library/Ruby/Gems/2.0.0/gems/mercenary-0.3.3/lib/mercenary.rb:22:in `program'
from /Library/Ruby/Gems/2.0.0/gems/jekyll-2.0.3/bin/jekyll:18:in `<top (required)>'
from /usr/bin/jekyll:23:in `load'
from /usr/bin/jekyll:23:in `<main>'

Since I'm new to Ruby, I have no idea why the above error is occurring. Can someone please help me explain why I'm getting the above error and sort it out?

Thanks

回答1:

You've got a couple of problems here. First, since you're using the long form of the watch option, you'll need to use two hyphens: --watch (or you could use the short form -w). Second, jekyll is looking for a subcommand such as build or serve, which you haven't provided.

I'm not sure exactly what command you are trying to issue, but it should look something like this:

jekyll build --watch

or

jekyll serve --watch

For more information check out jekyll basic usage.



标签: ruby jekyll