安装后尝试在 Hugo 中创建第一个网站 post 时获取 "unmarshal failed"

Getting "unmarshal failed" when trying to create first website post in Hugo after installation

我正在按照 Hugo 的快速入门指南 (https://gohugo.io/getting-started/quick-start/) 中的说明进行操作,但是当我尝试创建 post:

时,我不断收到此错误消息
unmarshal failed: Near line 1 (last key parsed 'theme'): expected value but found '\' instead

我已经 post编辑了下面几行代码。错误消息出现在底部。谁能帮忙指出我做错了什么?

C:\Users\Scott\quickstart\MyHugoBlog\themes>git init
Initialized empty Git repository in C:/Users/Scott/quickstart/MyHugoBlog/themes/.git/

C:\Users\Scott\quickstart\MyHugoBlog\themes>git submodule add https://github.com/dashdashzako/paperback.git
Cloning into 'C:/Users/Scott/quickstart/MyHugoBlog/themes/paperback'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 194 (delta 3), reused 9 (delta 1), pack-reused 178 eceiving objects:  53% (103/194)
Receiving objects: 100% (194/194), 466.30 KiB | 5.62 MiB/s, done.
Resolving deltas: 100% (93/93), done.
warning: LF will be replaced by CRLF in .gitmodules.
The file will have its original line endings in your working directory

C:\Users\Scott\quickstart\MyHugoBlog\themes>echo theme = \"paperback\" >> config.toml

C:\Users\Scott\quickstart\MyHugoBlog\themes>hugo new posts/my-first-post.md
Error: "C:\Users\Scott\quickstart\MyHugoBlog\themes\config.toml:1:1": unmarshal failed: Near line 1 (last key parsed 'theme'): expected value but found '\' instead

您似乎在遵循 Windows 上针对类 Unix 系统的说明。此命令未执行您想要的操作:

echo theme = \"paperback\" >> config.toml

例如,在 Linux 上使用 Bash,这会附加

theme = "paperback"

到您的 config.toml 文件,必要时创建它。这就是 Hugo 希望在文件中找到的内容。

但是,在 Windows 上使用 cmd.exe 我得到了反斜杠:

theme = \"paperback\"

使用 PowerShell,我得到了更奇怪的东西:

theme
=
\paperback\

在我看来,这些都不是有效的 TOML,并且都包含您的错误消息中引用的无关反斜杠。我建议您使用您最喜欢的文本编辑器简单地编辑 config.toml 并添加预期的

theme = "paperback"

手动排队。