这几天有兴致研究了一些东西想更新下博客,但发现Jekyll不能运行,把过程中踩到的一些坑记录下,以便他人:
首先提示版本错误:
zsh: /usr/local/bin/jekyll: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin: no such file or directory
运行 ruby –version 查看系统ruby版本已经升级到了2.3.3,运行命令更新jekyll和bundler,因为新版macOS /usr/bin不能写,需要手动指定安装到/usr/local/bin目录
sudo gem install -n /usr/local/bin jekyll bundler
升级后,运行jekyll serve,又提示错误:
/Library/Ruby/Site/2.3.0/bundler/spec_set.rb:88:in `block in materialize’: Could not find public_suffix-2.0.4 > in any of the sources (Bundler::GemNotFound)
from /Library/Ruby/Site/2.3.0/bundler/spec_set.rb:82:in `map!’
from /Library/Ruby/Site/2.3.0/bundler/spec_set.rb:82:in `materialize’
from /Library/Ruby/Site/2.3.0/bundler/definition.rb:170:in `specs’
from /Library/Ruby/Site/2.3.0/bundler/definition.rb:237:in `specs_for’
from /Library/Ruby/Site/2.3.0/bundler/definition.rb:226:in `requested_specs’
from /Library/Ruby/Site/2.3.0/bundler/runtime.rb:108:in `block in definition_method’
from /Library/Ruby/Site/2.3.0/bundler/runtime.rb:20:in `setup’
from /Library/Ruby/Site/2.3.0/bundler.rb:107:in `setup’
from /Library/Ruby/Gems/2.3.0/gems/jekyll-3.6.2/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler’
from /Library/Ruby/Gems/2.3.0/gems/jekyll-3.6.2/exe/jekyll:11:in `<top (required)>’
from /usr/local/bin/jekyll:23:in `load’
from /usr/local/bin/jekyll:23:in `<main>’
Google了一下没找到答案,看了下代码,觉得应该是_config.yml相关依赖库没升级造成的问题,运行命令升级依赖库:
bundle update
再次运行,能启动起来了,但有个警告:
Deprecation: The ‘gems’ configuration option has been renamed to ‘plugins’. Please update your config file accordingly.
打开_config.yml将gems修改为plugins,问题解决
原始链接 版权声明:自由转载-非商用-非衍生-保持署名 | Creative Commons BY-NC-ND 4.0