0

尝试运行 Netlify CMS 时出现此错误

Error loading the CMS configuration
Config Errors:

YAMLSyntaxError: Failed to resolve SEQ_ITEM node here at line 10, column 1:

    - name: Posts
^^^^^^^^^^^^^^…

Check your config.yml file.

我检查了语法并尝试了不同的语法,但在config.yml文档中的某处我仍然得到相同的错误。

这是麻烦的 config.yml 文件:

backend:
  name: git-gateway
  branch: master

media_folder: src/assets/images
media_library:
    name: uploads

collections:
    - name: Posts
      label: Posts
      create: true
      folder: "/articles"
      slug: articles/{{slug}}
      fields:
        - {label: Title, name: title, widget: string}
        - {label: Publish Date, name: date, widget: datetime}
        - {label: Featured Image, name: cover_image, widget: image}
        - {label: Body, name: body, widget: markdown}

这是我从https://drive.google.com/file/d/1OJPKJRgCljxAG5UuUxXkBPPNoUcyJe48/view?usp=sharing收到错误的文件的链接

4

1 回答 1

2

您链接的文件使用制表符进行缩进。YAML 使用空格,请参阅规范

通常,缩进定义为行首的零个或多个空格字符。

为了保持可移植性,缩进中不能使用制表符,因为不同的系统对制表符的处理方式不同。

您需要将制表符转换为空格。

于 2020-05-04T21:32:43.870 回答