Testing Jekyll Locally on a Windows
source link: https://neulionweb.dev/2021/11/run-jekyll-locally
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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 installridk
automatically. - 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. Prepending
bundle 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)
Related Issues not found
Please contact @cammytang @helloint to initialize the comment
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK