当前位置: 代码网 > it编程>操作系统>苹果Mac > macOS Monterey安装Jekyll

macOS Monterey安装Jekyll

2024年07月28日 苹果Mac 我要评论
macOS版本Monterey。先看官方教程https://jekyllrb.com/docs/installation/macos/,结果执行到以下这一步时报错。错误日志如下:直接访问可以访问,Google、百度搜了半天没有找到相关解决方案。无奈去了Ruby官网https://www.ruby-lang.org/en/documentation/installation/#homebrew找到官方教程。貌似一下装成功了。用看了一下还是。按照提示执行以下下命令,切换到最新版本。再命令,输入,对

macos版本monterey。

先看官方教程https://jekyllrb.com/docs/installation/macos/,结果执行到以下这一步ruby-install ruby时报错。
错误日志如下:

>>> updating ruby versions ...
!!! failed to download https://raw.githubusercontent.com/postmodern/ruby-versions/master/ruby/versions.txt to /users/xxx/.cache/ruby-install/ruby/versions.txt!
!!! failed to download ruby versions!

直接访问https://raw.githubusercontent.com/postmodern/ruby-versions/master/ruby/versions.txt可以访问,google、百度搜了半天没有找到相关解决方案。

安装ruby

无奈去了ruby官网
https://www.ruby-lang.org/en/documentation/installation/#homebrew
找到官方教程。

brew install ruby

貌似一下装成功了。
ruby -v看了一下还是ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.x86_64-darwin21]

切换ruby版本

按照提示执行以下下命令,切换到最新版本。

echo 'export path="/usr/local/opt/ruby/bin:$path"' >> ~/.zshrc

ruby -v命令,输入ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20],对了。

安装jekyll

再回到之前jekyll安装步骤,执行以下命令:

gem install jekyll

噼里啪啦,装好了。

看step by step教程https://jekyllrb.com/docs/step-by-step/01-setup/

gem install jekyll bundler

进入工作目录

cd ~/workspace/yourname.github.io

初始化生成gemfile,类似nodejs npm。

bundle init

vi编辑gemfile文件。

# frozen_string_literal: true
source "https://rubygems.org"
gem "jekyll"

执行bundle命令

bundle

执行jekyll build

bundle exec jekyll build

jekyll serve

bundle exec jekyll serve

打开浏览器,访问http://localhost:4000,可以看到页面了。

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com