我正在关注 Michael Hartl 的 Learn Enough CSS 课程。我当前的文件夹布局如下:
- _layouts
- _site
index.html
Run Code Online (Sandbox Code Playgroud)
哪里index.html:
---
layout: test
---
Run Code Online (Sandbox Code Playgroud)
我test.html有_layouts:
Hello again, world.
Run Code Online (Sandbox Code Playgroud)
每当我运行时jekyll serve,我都会收到此错误:
Error reading file /Users/pj/Documents/LETGD/repos/pohjie.github.io/_layouts/test.html: no implicit conversion of Hash into Integer
Error reading file /Users/pj/Documents/LETGD/repos/pohjie.github.io/index.html: no implicit conversion of Hash into Integer
Run Code Online (Sandbox Code Playgroud)
有人知道发生了什么事吗?我使用的是 M1 MacBook,不确定这是否是一个可能的原因,因为我也花了很多时间安装 Ruby。
谢谢!
虽然降级确实有效,但它可能非常烦人并且(取决于您需要的地方)有问题。如果您只想要一个简单的解决方法,您可以利用 Ruby 3 仍然可以使用的事实jekyll build,并单独提供页面:
bundler exec jekyll build && bash -c 'cd _site && python -m http.server 3000'
Run Code Online (Sandbox Code Playgroud)
唯一的缺点是你失去了自动重新加载的功能。如果您更改任何内容,则需要重新启动 jekyll。但是您可以在 Ruby 3 环境中运行它,而无需修改环境本身。
| 归档时间: |
|
| 查看次数: |
3857 次 |
| 最近记录: |