更新 jekyll 站点

Update jekyll site

我正在尝试更新一个 jekyll 博客,想先在我的浏览器上查看它。我 运行 jekyll serve 得到了:

rbenv: jekyll: command not found

The `jekyll' command exists in these Ruby versions:
2.1.0

为什么会出现此错误?我也运行bundle exec jekyll serve:

Could not locate Gemfile or .bundle/ directory

如果有帮助,这是 echo $PATH

的结果

/Users/BLAH/.rbenv/shims:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/aa/npm/bin:/usr/local/share/npm/bin

如果这也有帮助,这是 rbenv versions

的结果
  system
  1.9.3-p551
  2.0.0-p353
  2.0.0-p598
  2.1.0
  * 2.1.4 (set by /Users/BLAH/.rbenv/version)

如何让 jekyll serve 重新工作?

您在使用 Ruby 2.1.0 时安装了 Jekyll gem,但后来切换到 2.1.4,其 gem 集中没有 Jekyll .

您需要在 gem 与 gem install jekyll 一起使用的集合中安装 Jekyll,或者您需要切换到另一个 Ruby 与 rbenv local 2.1.0

I also ran bundle exec jekyll serve This is the result: Could not locate Gemfile or .bundle/ directory

您需要启动服务器。我解决了这个问题:

$ jekyll serve
# => A development server will run at http://localhost:4000/
# Auto-regeneration: enabled. Use `--no-watch` to disable.

$ jekyll serve --detach
# => Same as `jekyll serve` but will detach from the current terminal.
#    If you need to kill the server, you can `kill -9 1234` where "1234" is the PID.
#    If you cannot find the PID, then do, `ps aux | grep jekyll` and kill the instance.