hexo: YAMLException: Specified list of YAML types (or a single Type object) contains a non-Type object.
I upgraded my hexo dependencies:
hexo ^6.0.0 → ^6.1.0
hexo-renderer-markdown-it ^5.0.0 → ^6.0.1
hexo-server ^2.0.0 → ^3.0.0
Check List
- I have already read Docs page & Troubleshooting page
- I have already searched existing issues and they are not help to me
- I examined error or warning messages and it’s difficult to solve
- Using the latest version of Hexo (run
hexo versionto check) - Node.js is higher than minimum required version
Expected behavior
Normal generation with hexo g.
Actual behavior
$ hexo g
YAMLException: Specified list of YAML types (or a single Type object) contains a non-Type object.
at /home/noraj/Dev/hackdoc/node_modules/hexo/node_modules/js-yaml/lib/schema.js:104:13
at Array.forEach (<anonymous>)
at Schema.extend (/home/noraj/Dev/hackdoc/node_modules/hexo/node_modules/js-yaml/lib/schema.js:102:12)
at Object.<anonymous> (/home/noraj/Dev/hackdoc/node_modules/hexo/lib/plugins/renderer/yaml.js:5:36)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at module.exports (/home/noraj/Dev/hackdoc/node_modules/hexo/lib/plugins/renderer/index.js:15:16)
at Hexo.init (/home/noraj/Dev/hackdoc/node_modules/hexo/lib/hexo/index.js:235:35)
at /home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/lib/hexo.js:49:17
at tryCatcher (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/async.js:15:14) {
reason: 'Specified list of YAML types (or a single Type object) contains a non-Type object.',
mark: undefined
}
It seems this line triggers it:
https://github.com/nodeca/js-yaml/blob/49baadd52af887d2991e2c39a6639baa56d6c71b/lib/schema.js#L104
How to reproduce?
I’m not able to create a minimal reproducible environment. It’s especially hard since the error message doesn’t tell me which file triggers the error. So I create a private repository with my code by I can only add user one by one as collaborator and not the whole hexojs/core team at once. So please ask me access and I’ll add you.
hexo g
Is the problem still there under “Safe mode”?
Yes it is a dependency of hexo core
$ hexo --safe
FATAL YAMLException: Specified list of YAML types (or a single Type object) contains a non-Type object.
at /home/noraj/Dev/hackdoc/node_modules/hexo/node_modules/js-yaml/lib/schema.js:104:13
at Array.forEach (<anonymous>)
at Schema.extend (/home/noraj/Dev/hackdoc/node_modules/hexo/node_modules/js-yaml/lib/schema.js:102:12)
at Object.<anonymous> (/home/noraj/Dev/hackdoc/node_modules/hexo/lib/plugins/renderer/yaml.js:5:36)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at module.exports (/home/noraj/Dev/hackdoc/node_modules/hexo/lib/plugins/renderer/index.js:15:16)
at Hexo.init (/home/noraj/Dev/hackdoc/node_modules/hexo/lib/hexo/index.js:235:35)
at /home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/lib/hexo.js:49:17
at tryCatcher (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/noraj/.asdf/installs/nodejs/17.5.0/.npm/lib/node_modules/hexo-cli/node_modules/bluebird/js/release/async.js:15:14) {
reason: 'Specified list of YAML types (or a single Type object) contains a non-Type object.',
mark: undefined
}
Environment & Settings
Node.js & npm version(node -v && npm -v)
v17.5.0
8.4.1
Your site _config.yml (Optional)
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site
title: title
subtitle: 'Documentation system'
description: 'static documentation site generator'
keywords:
- documentation
- markdown
- custom
- staticgen
author: John Doe
language: en
timezone: ''
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.com
root: /root/
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing index.html from permalinks
# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
enable: true # Open external links in new tab
field: site # Apply to the whole site
exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
enable: false
prismjs:
enable: false
# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
path: ''
per_page: 10
order_by: -date
# Category & Tag
default_category: uncategorized
category_map:
tag_map:
# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true
# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## Use post's date for updated date unless set in front-matter
updated_option: empty
# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page
# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
exclude:
ignore:
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: hackdoc
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: ''
markdown:
render:
html: true
xhtmlOut: false
langPrefix: 'lang-'
breaks: false
linkify: true
typographer: false
quotes: '“”‘’'
plugins:
anchors:
level: 2
collisionSuffix: '-'
permalink: true,
permalinkClass: 'header-anchor'
permalinkSide: 'right'
permalinkSymbol: '#'
case: 0
separator: '-'
jsonContent:
meta: false
drafts: false
file: content.json
keywords: undefined
dateFormat: undefined
pages:
title: true
slug: true
date: false
updated: false
comments: false
path: true
link: true
permalink: true
excerpt: false
keywords: false
text: true
raw: false
content: false
author: false
posts:
title: true
slug: true
date: false
updated: false
comments: false
path: true
link: false
permalink: true
excerpt: false
keywords: false
text: true
raw: false
content: false
author: false
categories: true
tags: true
Your theme _config.yml
Changing the theme to landscape still triggers the error so it’s not from my theme.
# Bulmaswatch theme/skin variant/style
# see available values https://jenil.github.io/bulmaswatch/
bulmaswatch: default # cerulean, cosmo, cyborg, darkly, default, flatly, journal, litera, lumen, lux, materia, minty, nuclear, pulse, sandstone, simplex, slate, solar, spacelab, superhero, united, yeti
# Highlight.js style
# see available values https://highlightjs.org/static/demo/
hljs: atom-one-dark # a11y-dark, a11y-light, agate, androidstudio, an-old-hope, arduino-light, arta, ascetic, atelier-cave-dark, atelier-cave-light, atelier-dune-dark, atelier-dune-light, atelier-estuary-dark, atelier-estuary-light, atelier-forest-dark, atelier-forest-light, atelier-heath-dark, atelier-heath-light, atelier-lakeside-dark, atelier-lakeside-light, atelier-plateau-dark, atelier-plateau-light, atelier-savanna-dark, atelier-savanna-light, atelier-seaside-dark, atelier-seaside-light, atelier-sulphurpool-dark, atelier-sulphurpool-light, atom-one-dark, atom-one-dark-reasonable, atom-one-light, brown-paper, codepen-embed, color-brewer, darcula, dark, darkula, default, docco, dracula, far, foundation, github, github-gist, gml, googlecode, grayscale, gruvbox-dark, gruvbox-light, hopscotch, hybrid, idea, ir-black, isbl-editor-dark, isbl-editor-light, kimbie.dark, kimbie.light, lightfair, magula, mono-blue, monokai, monokai-sublime, night-owl, nord, obsidian, ocean, paraiso-dark, paraiso-light, pojoaque, purebasic, qtcreator_dark, qtcreator_light, railscasts, rainbow, routeros, school-book, shades-of-purple, solarized-dark, solarized-light, sunburst, tomorrow, tomorrow-night-blue, tomorrow-night-bright, tomorrow-night, tomorrow-night-eighties, vs2015, vs, xcode, xt256, zenburn
# Navbar at the top or the bottom
navbar:
position: top # top, bottom
title: true # display the title in navbar or not
toc: true # enable Table of Content (right bar)
logo:
path: '/images/hackdoc_512.svg'
navbar: true # display logo in the navbar (menu)
sidebar: true # display logo in the sidebar
favicon:
path: '/images/hackdoc_32.ico'
archive:
style: 'both' # list, timeline, both
# Sass rendering options
node_sass:
outputStyle: compressed
precision: 5
sourceComments: false
Hexo and Plugin version(npm ls --depth 0)
hexo-site@0.0.0 /home/noraj/Dev/hackdoc
├── hexo-description@0.1.0
├── hexo-excerpt-block@1.0.0
├── hexo-generator-archive@1.0.0
├── hexo-generator-category@1.0.0
├── hexo-generator-feed@3.0.0
├── hexo-generator-index@2.0.0
├── hexo-generator-json-content@4.2.3
├── hexo-generator-tag@1.0.0
├── hexo-multiauthor@0.0.1
├── hexo-render-pug@2.1.4
├── hexo-renderer-markdown-it@6.0.1
├── hexo-renderer-sass@0.4.0
├── hexo-server@3.0.0
├── hexo-spoiler@1.7.3
├── hexo-tag-admonition@1.2.0
├── hexo-tag-asciinema@0.0.3
├── hexo-tag-color-block@0.0.3
├── hexo-tag-kbd@0.0.1
├── hexo-tag-qrcode@1.0.0
└── hexo@6.1.0
Your package.json package.json
{
"name": "hexo-site",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"hexo": {
"version": "6.0.0"
},
"dependencies": {
"hexo": "^6.1.0",
"hexo-description": "^0.1.0",
"hexo-excerpt-block": "^1.0.0",
"hexo-generator-archive": "^1.0.0",
"hexo-generator-category": "^1.0.0",
"hexo-generator-feed": "^3.0.0",
"hexo-generator-index": "^2.0.0",
"hexo-generator-json-content": "^4.2.3",
"hexo-generator-tag": "^1.0.0",
"hexo-multiauthor": "^0.0.1",
"hexo-render-pug": "^2.1.4",
"hexo-renderer-markdown-it": "^6.0.1",
"hexo-renderer-sass": "^0.4.0",
"hexo-server": "^3.0.0",
"hexo-spoiler": "^1.7.3",
"hexo-tag-admonition": "^1.2.0",
"hexo-tag-asciinema": "0.0.3",
"hexo-tag-color-block": "0.0.3",
"hexo-tag-kbd": "0.0.1",
"hexo-tag-qrcode": "^1.0.0"
}
}
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 37 (14 by maintainers)
Commits related to this issue
- fix(#4917): suppress YAMLException when load js-yaml * it is just a workaround — committed to yoshinorin/hexo by yoshinorin 2 years ago
- fix(#4917): suppress YAMLException when load js-yaml (#4927) * it is just a workaround — committed to hexojs/hexo by yoshinorin 2 years ago
- fix(#4917): suppress YAMLException when load js-yaml (#4927) * it is just a workaround — committed to yoshinorin/hexo by yoshinorin 2 years ago
- fix(#4917): downgrade `js-yaml` from `v4.x` to `v3.14.x` — committed to yoshinorin/hexo by yoshinorin 2 years ago
- fix(#4917): downgrade `js-yaml` from `v4.x` to `v3.14.x` (#4932) — committed to hexojs/hexo by yoshinorin 2 years ago
- fixed: #link https://github.com/hexojs/hexo/issues/4917 — committed to sakitam-fdd/website by sakitam-fdd 2 years ago
- 🐛 fix bug https://github.com/hexojs/hexo/issues/4917#issuecomment-1193351742 — committed to Ahaochan/Ahaochan.github.io by Ahaochan 2 years ago
Yes, I know. Not sure, but I assume this error seems incorrect version resolving of
js-yaml.How to reproduce?
Dependency tree
Here is the dependency tree after exec
How to reproduce?section. Certainly,hexo@6.1.0depends onjs-yaml@4.1.0and it seems no problem.But, as you know exception occurs when run test. I wrote at the beginning of this comment, I’m not sure but it seems the
require('js-yaml')resolves older than the4.0.0version ofjs-yaml..I don’t know which is the cause
hexo,npm, orjs-yaml.Workaround
As I wrote in https://github.com/hexojs/hexo/issues/4917#issuecomment-1084567773. This exception will not occur after install
js-yaml@4.1.0manually. Because when you install a package manually npm use it preferentially.Just my 50 cents…
All of these tips above only worked for me after deleting
node_modules,package-lock.json, adding"js-yaml": "^4.1.0"topackage.jsonand runnpm install.Now I got what I want … fresh Hexo installation
I tried
yarn add js-yaml@latest, and it seems to solve the problem.latest of
hexo-cliautomated change localhexopackage to version6.0.0so sad 😦 now, my website https://webmanajemen.com got truncated for many posts (i didnt check one by one of 800+ pages)6.1.0to6.0.0inpackage.jsonif still get errors. delete
package-lock.jsonandnode_modulesthen reinstall withnpm install hexo@6.0.0fixed workflow https://github.com/dimaslanjaka/dimaslanjaka.github.io/runs/5657131614?check_suite_focus=true
I don’t use hexo but had the same issue on my project. Landed here while trying to see if anyone was having the same issue and that it wasn’t just me doing something stupid.
Did some digging and the problem is with the js-yaml-js-type dependency. If they move js-yaml as a peer dependency there it will ensure that the same instance/version is used and this error will go away. I opened a pull request to address it, hopefully it gets merged soon.
nodeca/js-yaml-js-types#5
@noraj @dimaslanjaka @kkfive @MCSeekeri @lzkids
How about below workaround?
I think this is probably effective. (I’m not sure this workaround has a bad side-effect or not. I think may be no bad side-effect… but not sure.)
P.S:
I have been able to reproduce this issue with https://github.com/hexojs/hexo-generator-category But, I think we need more time to fix this issue.
Added a PR to the docs’ troubleshotting page regarding this issue.
I STILL have this problem after upgrading from 4.1.0 to 6.3.0, and
npm install js-yaml@latestsolved it.i have same problem on 6.2.0
It is already js-yaml 4.1.0 that is shipped with hexo 6.1.0
https://github.com/hexojs/hexo/blob/8d2102745fb804278238df4ba7832b871a78d899/package.json#L51
It’s already what is in my
package-lock.json. However I had to change this:i solved this problem by installing version 6.0.0.