Jekyll安装windowsh环境(重制)
安装步骤
重新部署本地Windows+jekyll环境
-
官网上下载ruby: https://rubyinstaller.org/downloads/ 一般安装完
Ruby后会自动弹出一个新的命令行安装界面,我们需要在里面选择 3,然后回车。
- 然后进行安装
退出的话cmd中输入
>ridk install可重新进入界面 输出以下信息即成功安装Install MSYS2 and MINGW development toolchain succeeded - 安装jekyll
gem install jekyll bundler

遇到报错1
Configuration file: D:/xyy/code/jellyXuuuuu.github.io/_config.yml
Dependency Error: Yikes! It looks like you don't have jekyll-gist or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. If you've run Jekyll with `bundle exec`, ensure that you have included the jekyll-gist gem in your Gemfile as well. The full error message from Ruby is: 'cannot load such file -- jekyll-gist' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
------------------------------------------------
Jekyll 4.4.1 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
遇到报错2
D:/Ruby34-x64/lib/ruby/3.4.0/win32/registry.rb:2: warning: fiddle/import is found in fiddle, which will no longer be part of the default gems starting from Ruby 3.5.0.
You can add fiddle to your Gemfile or gemspec to silence this warning.
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
Dependency Error: Yikes! It looks like you don't have jekyll-paginate or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. If you've run Jekyll with `bundle exec`, ensure that you have included the jekyll-paginate gem in your Gemfile as well. The full error message from Ruby is: 'cannot load such file -- jekyll-paginate' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
------------------------------------------------
Jekyll 4.4.1 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
方式一: 直接安装所缺的gem包
- 安装
jekyll-gistgem install jekyll-gist - 安装
jekyll-paginategem install jekyll-paginate - 安装
jekyll-seo-taggem install jekyll-seo-tag - 本项目所需gem:
gem install jekyll:4.4.1 jekyll-gist jekyll-paginate jekyll-seo-tag
- 如果网络波动较大,可增加国内源:
# 先移除旧源(不管之前是哪个,确保只留一个新源) gem sources --remove https://mirrors.aliyun.com/rubygems/ # 添加腾讯云镜像源 gem sources --add https://mirrors.tencent.com/rubygems/ # 查看当前源,确保只有腾讯云这一个 gem sources(可选)清理bundle旧缓存,避免残留依赖影响分析
bundle clean --force - 运行serve
jekyll serve
| 注: 需要先进入D:\xyy\code\jellyXuuuuu.github.io目录下, 即部署的项目目录下才能启动
D:
cd D:\xyy\code\jellyXuuuuu.github.io
jekyll serve
最后直接访问127.0.0.1:4000

注: 运行jekyll serve后有很多warning,但看起来不影响运行 日志见jekyll启动日志.log
方式二(尝试失败):
增加Gemfile文件:
source "https://mirrors.aliyun.com/rubygems/" # 必须是国内源,避免网络问题
gem "jekyll", "~> 4.4.1" # 与你使用的 Jekyll 版本匹配
gem "jekyll-gist"
gem "jekyll-paginate" # 必须包含,且无拼写错误
gem "jekyll-seo-tag" # 配置中用到的 seo 插件,也要加进来
在命令行执行以下命令, 彻底清理旧依赖并重新安装:
# 1. 删除旧的依赖锁定文件
del Gemfile.lock
# 2. 重新安装所有依赖(包括 jekyll-paginate 和 jekyll-seo-tag)
bundle install
运行serve
bundle exec jekyll serve