1、问题
vuePress执行build操作的时候
vuepress build ~/my_blogs/docs/
错误提示如下
YAMLException: end of the stream or a document separator is expected at line 7, column 9: features: ^ at generateError (/usr/lib/node_modules/vuepress/node_modules/js-yaml/lib/js-yaml/loader.js:167:10) at throwError (/usr/lib/node_modules/vuepress/node_modules/js-yaml/lib/js-yaml/loader.js:173:9) at readDocument (/usr/lib/node_modules/vuepress/node_modules/js-yaml/lib/js-yaml/loader.js:1545:5) at loadDocuments (/usr/lib/node_modules/vuepress/node_modules/js-yaml/lib/js-yaml/loader.js:1588:5) at load (/usr/lib/node_modules/vuepress/node_modules/js-yaml/lib/js-yaml/loader.js:1614:19) at Object.safeLoad (/usr/lib/node_modules/vuepress/node_modules/js-yaml/lib/js-yaml/loader.js:1637:10) at module.exports (/usr/lib/node_modules/vuepress/node_modules/gray-matter/lib/parse.js:12:17) at parseMatter (/usr/lib/node_modules/vuepress/node_modules/gray-matter/index.js:109:17) at Object.matter [as default] (/usr/lib/node_modules/vuepress/node_modules/gray-matter/index.js:50:10) at parseFrontmatter (/usr/lib/node_modules/vuepress/node_modules/@vuepress/shared-utils/lib/parseFrontmatter.js:8:33) at Page.process (/usr/lib/node_modules/vuepress/node_modules/@vuepress/core/lib/node/Page.js:106:44) at async App.addPage (/usr/lib/node_modules/vuepress/node_modules/@vuepress/core/lib/node/App.js:354:5) at async /usr/lib/node_modules/vuepress/node_modules/@vuepress/core/lib/node/App.js:339:7 at async Promise.all (index 0) at async App.resolvePages (/usr/lib/node_modules/vuepress/node_modules/@vuepress/core/lib/node/App.js:337:5) at async App.process (/usr/lib/node_modules/vuepress/node_modules/@vuepress/core/lib/node/App.js:115:5)
2、原因
我的READMDE.md文件格式有问题
--- home:true heroImage:/hero.png heroText:Hero标题 tagline:Hero副标题 actionText:快速上手→ actionLink:/zh/guide/ features: - title:简洁至上 details:以Markdown为中心的项目结构,以最少的配置帮助你专注于写作。 - title:Vue驱动 details:享受Vue+ webpack 的开发体验,在Markdown中使用Vue组件,同时可以使用Vue来开发自定义主题。 - title:高性能 details:VuePress为每个页面预渲染生成静态的 HTML,同时在页面被加载的时候,将作为 SPA 运行。 footer: MIT Licensed|Copyright©2018-present EvanYou ---root@iZm5e6dk6exl71zbx327zvZ:~/my_blogs/docs#
3、解决办法
:后面需要加上空格,修复后的README.md文件如下
--- home: true heroText: Hero标题 tagline: Hero副标题 actionText: 快速上手→ actionLink: /README.md features: - title: 简洁至上 details: 以Markdown为中心的项目结构,以最少的配置帮助你专注于写作。 - title: Vue驱动 details: 享受Vue+ webpack 的开发体验,在Markdown中使用Vue组件,同时可以使用Vue来开发自定义主题。 - title: 高性能 details: VuePress为每个页面预渲染生成静态的 HTML,同时在页面被加载的时候,将作为 SPA 运行。 footer: MIT Licensed|Copyright©2020-present 湘ICP备 20001035号 ---