It is not easy to install Jekyll on a Windows machine.
Install
You can follow Testing your GitHub Pages site locally with Jekyll step by step, or here is some brief instruction:
- Download and install Ruby+Devkit.
Make sure to choose ‘Ruby+Devkit’. At the end, the installer will installridkautomatically. - Run
gem install jekyll bundler. - Run
jekyll -v, check if installation successfully.
Make sure to not run it on Jekyll project directory (containsGemfile) or you will see exception. - Go to Jekyll project directory, run
bundle install. - Run
bundle exec jekyll serve.
And the service will start up at http://localhost:4000/
Trouble Shooting
C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/lib/bundler/runtime.rb:309:in
check_for_activated_spec!': You have already activated addressable 2.8.0, but your Gemfile requires addressable 2.7.0. Prependingbundle exec` to your command may solve this. (Gem::LoadError)
Solution: Do not run jekyll -v on a directory that contains Gemfile.
bundler: failed to load command: jekyll (/usr/local/lib/ruby/gems/3.0.0/bin/jekyll) /usr/local/lib/ruby/gems/3.0.0/gems/jekyll-3.9.0/lib/jekyll/commands/serve/servlet.rb:3:in `require’: cannot load such file – webrick (LoadError)
Cause: Because you installed Ruby 3.0 and it doesn’t include webrick
Solution: Run bundle add webrick
Reference: Jekyll serve fails on Ruby 3.0 (webrick missing)
About Ruby and its eco system
Ruby, Gem, Bundler
- ruby是一个面向对象的脚本语言。
- rvm是不同ruby版本的管理和切换工具。
- gem是ruby写的软件包。
- rubygems是用来打包、下载、安装、使用gem软件包的工具。
- bundler是管理ruby项目一系列gem的工具,就像ios 包管理工具的cocopods一样。bundler会根据gemfile文件定义的约束去管理这些gem。
Reference: ruby、rvm、gem、gems、bundle、gemfile简单总结.
Difference between ruby and node
| Language | Node | Ruby |
|---|---|---|
| Package Manager | npm | RubyGems |
| A Package | package | gem |
| Install to Global | npm install [pkg] -g |
gem install [pkg] |
| Install to Project | npm install |
bundle install |
| Description File | package.json |
Gemfile |
| Dependency Tree | package-lock.json |
Gemfile.lock |
(转载本站文章请注明作者和出处 NeuLion Web)