Skip to content

Commit

Permalink
Add solution to YAMLExpection (hexojs#1931)
Browse files Browse the repository at this point in the history
Co-authored-by: Baoshuo Ren <[email protected]>
  • Loading branch information
leostudiooo and renbaoshuo authored Oct 19, 2022
1 parent 63692da commit 0bfa5b2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
20 changes: 20 additions & 0 deletions source/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,26 @@ Template render error: (unknown path)

One possible reason is that there are some unrecognizable words in your file, e.g. invisible zero width characters.

## YAMLException (Issue [#4917](https://github.com/hexojs/hexo/issues/4917))

Upgrading to `hexo^6.1.0` from an older version may cause the following error when running `$ hexo generate`:

```
YAMLException: Specified list of YAML types (or a single Type object) contains a non-Type object.
at ...
```

This may be caused by an incorrect dependency(i.e. `js-yaml`) setting that can't be solved automatically by the package manager, and you may have to update it manually running:

```sh
$ npm install js-yaml@latest
```
or
```sh
$ yarn add js-yaml@latest
```
if you use `yarn`.

[Warehouse]: https://github.com/hexojs/warehouse
[Swig]: http://paularmstrong.github.io/swig/
[Nunjucks]: https://mozilla.github.io/nunjucks/
17 changes: 17 additions & 0 deletions source/zh-cn/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,23 @@ Template render error: (unknown path)

一种可能的原因是你的文件中存在一些不可被识别的字符,比如不可见的零宽度字符。

## YAMLException (Issue [#4917](https://github.com/hexojs/hexo/issues/4917))

从低版本的 Hexo 升级到 Hexo 6.1.0 及以上版本之后,可能会在生成站点时出现以下错误:

```
YAMLException: Specified list of YAML types (or a single Type object) contains a non-Type object.
at ...
```

这可能是由于存在包管理器无法自动修复的不正确的依赖项(即 `js-yaml`)引起的,您需要手动更新它:

```sh
$ npm install js-yaml@latest
# 如果您使用 yarn 作为包管理器,请运行下面这个命令:
$ yarn add js-yaml@latest
```

[Warehouse]: https://github.com/hexojs/warehouse
[Swig]: http://paularmstrong.github.io/swig/
[Nunjucks]: https://mozilla.github.io/nunjucks/

0 comments on commit 0bfa5b2

Please sign in to comment.