jekyll 命令使用。
Windows安装
安装
下载:https://rubyinstaller.org/downloads/,文件:rubyinstaller-devkit-xx。
双击安装。
输入ruby -v
确认。
1 | gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ |
在 jekyll 目录构建网站:
1 | bundle exec jekyll b |
服务运行:
1 | bundle exec jekyll serve -H 0.0.0.0 -P 8080 |
问题及解决
1 | find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) |
1 | 提示:Could not locate Gemfile |
已有Gemfile文件,但里面的版本较旧,移到其它电脑,重新安装,但版本较新。Gemfile不适应。执行jekyll new my-awesome-site
生成一个简单网站示例,从中拿到Gemfile,替换之。
安装指定版本的bundle:
1 | gem install bundler -v 1.16.1 |
Ubuntu安装
1 | gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ |