hexo icon indicating copy to clipboard operation
hexo copied to clipboard

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

Open noraj opened this issue 2 years ago • 30 comments

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

  • [x] I have already read Docs page & Troubleshooting page
  • [x] I have already searched existing issues and they are not help to me
  • [x] I examined error or warning messages and it's difficult to solve
  • [x] Using the latest version of Hexo (run hexo version to check)
  • [x] 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)

[email protected] /home/noraj/Dev/hackdoc
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

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"
  }
}

noraj avatar Mar 19 '22 14:03 noraj

i have same problem too

dimaslanjaka avatar Mar 20 '22 01:03 dimaslanjaka

@dimaslanjaka Have you a public repository with the error happening?

noraj avatar Mar 20 '22 19:03 noraj

i have same problem too. i change the package manager for PNPM solved the problem

kkfive avatar Mar 21 '22 14:03 kkfive

I also encountered this problem. Has it been solved?

lzkids avatar Mar 23 '22 04:03 lzkids

i solved this problem by installing version 6.0.0.

npm i [email protected]

dimaslanjaka avatar Mar 23 '22 04:03 dimaslanjaka

@dimaslanjaka Have you a public repository with the error happening?

I have this problem too https://github.com/MCSeekeri/sciadv/runs/5655539928?check_suite_focus=true

MCSeekeri avatar Mar 23 '22 05:03 MCSeekeri

I also encountered this problem. Has it been solved?

No @lzkids

i solved this problem by installing version 6.0.0.

~~I already have v6.0.0 as stated in package.json @dimaslanjaka~~

@MCSeekeri thanks for sharing the URL

noraj avatar Mar 23 '22 08:03 noraj

@dimaslanjaka Have you a public repository with the error happening?

I have this problem too https://github.com/MCSeekeri/sciadv/runs/5655539928?check_suite_focus=true

My fixed workflow https://github.com/dimaslanjaka/dimaslanjaka.github.io/actions

dimaslanjaka avatar Mar 23 '22 08:03 dimaslanjaka

  • install hexo 6.0.0
npm i [email protected]
  • replace hexo version 6.1.0 to 6.0.0 in package.json
{
  "hexo": {
    "version": "6.0.0"
  }
}

if still get errors. delete package-lock.json and node_modules then reinstall with npm install [email protected]

fixed workflow https://github.com/dimaslanjaka/dimaslanjaka.github.io/runs/5657131614?check_suite_focus=true

dimaslanjaka avatar Mar 23 '22 08:03 dimaslanjaka

replace hexo version 6.1.0 to 6.0.0 in package.json

Nice to know, thk for the workaround. It confirms 6.1.0 has introduced a bug and need to be fixed.

noraj avatar Mar 23 '22 08:03 noraj

Relevant pull request: https://github.com/hexojs/hexo/pull/4869

stevenjoezhang avatar Mar 23 '22 09:03 stevenjoezhang

  • install hexo 6.0.0
npm i [email protected]
* replace hexo version `6.1.0` to `6.0.0` in `package.json`
{
  "hexo": {
    "version": "6.0.0"
  }
}

if still get errors. delete package-lock.json and node_modules then reinstall with npm install [email protected]

fixed workflow https://github.com/dimaslanjaka/dimaslanjaka.github.io/runs/5657131614?check_suite_focus=true

thk

lzkids avatar Mar 24 '22 03:03 lzkids

@noraj @dimaslanjaka @kkfive @MCSeekeri @lzkids

How about below workaround?

// In your hexo project
// for hexo 6.1.0
$ npm install [email protected]

// for hexo 6.0.0
$ npm install [email protected]

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.

yoshinorin avatar Mar 31 '22 13:03 yoshinorin

How about below workaround?

// In your hexo project
// for hexo 6.1.0
$ npm install [email protected]

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:

  "hexo": {
-    "version": "6.0.0"
+    "version": "6.1.0"
  },
  "dependencies": {
    "hexo": "^6.1.0",

noraj avatar Mar 31 '22 17:03 noraj

It is already js-yaml 4.1.0 that is shipped with hexo 6.1.0

Yes, I know. Not sure, but I assume this error seems incorrect version resolving of js-yaml.

How to reproduce?

// git clone & checkout
$ git clone https://github.com/hexojs/hexo-generator-category.git
$ git checkout -b issue-4917 f51949900e5dbd15902b45fe4399afb634d54b21
$ git log --oneline
  f519499 (HEAD -> issue-4917) chore(ci): migrate travisCI to GitHubActions (#70)
  f233a38 chore(deps): bump hexo-pagination from 1.0.0 to 2.0.0 (#46)
  fadee1a Upgrade to GitHub-native Dependabot (#45)

// [email protected] will be installed
$ npm install

// install [email protected]
$ npm install [email protected]

// run test
$ npm run test

> [email protected] test
> mocha test/index.js

YAMLException: Specified list of YAML types (or a single Type object) contains a non-Type object.
    at /mnt/c/Users/username/development/hexo/hexo-generator-category/node_modules/hexo/node_modules/js-yaml/lib/schema.js:104:13
    at Array.forEach (<anonymous>)
    at Schema.extend (/mnt/c/Users/username/development/hexo/hexo-generator-category/node_modules/hexo/node_modules/js-yaml/lib/schema.js:102:12)
    at Object.<anonymous> (/mnt/c/Users/username/development/hexo/hexo-generator-category/node_modules/hexo/lib/plugins/renderer/yaml.js:5:36)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)

Dependency tree

Here is the dependency tree after exec How to reproduce? section. Certainly, [email protected] depends on [email protected] and it seems no problem.

$ npm list js-yaml

[email protected] /mnt/c/Users/username/hexo/hexo-generator-category
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ @eslint/[email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]             <- should be use this. but not actually used???
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
  └─┬ @istanbuljs/[email protected]
    └── [email protected] deduped

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 the 4.0.0 version of js-yaml..

I don't know which is the cause hexo, npm, or js-yaml.

Workaround

As I wrote in https://github.com/hexojs/hexo/issues/4917#issuecomment-1084567773. This exception will not occur after install [email protected] manually. Because when you install a package manually npm use it preferentially.

$ npm install [email protected]
// for hexo 6.0.0
// $ npm install [email protected]

$ npm list js-yaml
[email protected] /mnt/c/Users/username/development/hexo/temp/hexo-generator-category
...
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├── [email protected]               <- npm use this after install manually
...

$ npm run test

> [email protected] test
> mocha test/index.js



  Category generator
    ✓ pagination enabled
    ✓ pagination disabled
    ✓ custom pagination_dir


  3 passing (67ms)

yoshinorin avatar Apr 01 '22 08:04 yoshinorin

It is already js-yaml 4.1.0 that is shipped with hexo 6.1.0

Yes, I know. Not sure, but I assume this error seems incorrect version resolving of js-yaml.

How to reproduce?

// git clone & checkout
$ git clone https://github.com/hexojs/hexo-generator-category.git
$ git checkout -b issue-4917 f51949900e5dbd15902b45fe4399afb634d54b21
$ git log --oneline
  f519499 (HEAD -> issue-4917) chore(ci): migrate travisCI to GitHubActions (#70)
  f233a38 chore(deps): bump hexo-pagination from 1.0.0 to 2.0.0 (#46)
  fadee1a Upgrade to GitHub-native Dependabot (#45)

// [email protected] will be installed
$ npm install

// install [email protected]
$ npm install [email protected]

// run test
$ npm run test

> [email protected] test
> mocha test/index.js

YAMLException: Specified list of YAML types (or a single Type object) contains a non-Type object.
    at /mnt/c/Users/username/development/hexo/hexo-generator-category/node_modules/hexo/node_modules/js-yaml/lib/schema.js:104:13
    at Array.forEach (<anonymous>)
    at Schema.extend (/mnt/c/Users/username/development/hexo/hexo-generator-category/node_modules/hexo/node_modules/js-yaml/lib/schema.js:102:12)
    at Object.<anonymous> (/mnt/c/Users/username/development/hexo/hexo-generator-category/node_modules/hexo/lib/plugins/renderer/yaml.js:5:36)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)

Dependency tree

Here is the dependency tree after exec How to reproduce? section. Certainly, [email protected] depends on [email protected] and it seems no problem.

$ npm list js-yaml

[email protected] /mnt/c/Users/username/hexo/hexo-generator-category
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├─┬ @eslint/[email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]             <- should be use this. but not actually used???
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
  └─┬ @istanbuljs/[email protected]
    └── [email protected] deduped

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 the 4.0.0 version of js-yaml..

I don't know which is the cause hexo, npm, or js-yaml.

Workaround

As I wrote in #4917 (comment). This exception will not occur after install [email protected] manually. Because when you install a package manually npm use it preferentially.

$ npm install [email protected]
// for hexo 6.0.0
// $ npm install [email protected]

$ npm list js-yaml
[email protected] /mnt/c/Users/username/development/hexo/temp/hexo-generator-category
...
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├── [email protected]               <- npm use this after install manually
...

$ npm run test

> [email protected] test
> mocha test/index.js



  Category generator
    ✓ pagination enabled
    ✓ pagination disabled
    ✓ custom pagination_dir


  3 passing (67ms)

latest of hexo-cli automated change local hexo package to version 6.0.0 so sad :( now, my website https://webmanajemen.com got truncated for many posts (i didnt check one by one of 800+ pages)

dimaslanjaka avatar Apr 04 '22 17:04 dimaslanjaka

I have the same situation after updating hexo to 6.1.0.

xtexChooser avatar May 01 '22 01:05 xtexChooser

We released hexo 6.2.0 just now. It includes this issue workaround.

https://github.com/hexojs/hexo/releases/tag/6.2.0

Thank you.

yoshinorin avatar May 10 '22 20:05 yoshinorin

We released hexo 6.2.0 just now. It includes this issue workaround.

https://github.com/hexojs/hexo/releases/tag/6.2.0

Thank you.

i have same problem on 6.2.0

ghost avatar Jun 01 '22 03:06 ghost

We released hexo 6.2.0 just now. It includes this issue workaround.

https://github.com/hexojs/hexo/releases/tag/6.2.0

Thank you.


PS D:\Users\20292\Documents\GitHub\hexo.bak> npm install hexo@latest -g

changed 93 packages in 4s

15 packages are looking for funding
  run `npm fund` for details
PS D:\Users\20292\Documents\GitHub\hexo.bak> hexo --safe
WARN  YAMLException: please see https://github.com/hexojs/hexo/issues/4917
FATAL TypeError: Cannot read property 'length' of undefined
    at composeNode (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\hexo\node_modules\js-yaml\lib\loader.js:1492:60)
    at readBlockMapping (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\hexo\node_modules\js-yaml\lib\loader.js:1104:12)
    at composeNode (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\hexo\node_modules\js-yaml\lib\loader.js:1441:12)
    at readDocument (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\hexo\node_modules\js-yaml\lib\loader.js:1625:3)
    at loadDocuments (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\hexo\node_modules\js-yaml\lib\loader.js:1688:5)
    at Object.load (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\hexo\node_modules\js-yaml\lib\loader.js:1714:19)
    at Hexo.yamlHelper (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\hexo\lib\plugins\renderer\yaml.js:20:15)
    at Hexo.tryCatcher (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\util.js:16:23)
    at Hexo.<anonymous> (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\method.js:15:34)
    at D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\hexo\lib\hexo\render.js:81:22
    at tryCatcher (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\promise.js:729:18)
    at _drainQueueStep (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\async.js:93:12)
    at _drainQueue (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\async.js:86:9)
    at Async._drainQueues (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (D:\Users\20292\Documents\GitHub\hexo.bak\node_modules\bluebird\js\release\async.js:15:14)
    at processImmediate (node:internal/timers:464:21)

greenhandzdl avatar Jun 14 '22 18:06 greenhandzdl

I tried yarn add js-yaml@latest, and it seems to solve the problem.

leostudiooo avatar Jul 24 '22 16:07 leostudiooo

Having the same problem on 6.2.0

luchaoqi avatar Aug 24 '22 03:08 luchaoqi

Having the same problem on 6.2.0

Have you tried this?

I tried yarn add js-yaml@latest, and it seems to solve the problem.

leostudiooo avatar Aug 24 '22 17:08 leostudiooo

Having the same problem on 6.2.0

Have you tried this?

I tried yarn add js-yaml@latest, and it seems to solve the problem.

Installed yarn and seems yarn add js-yaml@latest solves the problem :)

luchaoqi avatar Aug 24 '22 17:08 luchaoqi

Why is version 6.2 still an error。but hexo gandhexo s http://localhost:4000/ is ok?

Jiangruoye avatar Aug 29 '22 11:08 Jiangruoye

I tried yarn add js-yaml@latest, and it seems to solve the problem.

Theoretically npm install js-yaml@latest may be ok as well.

Why is version 6.2 still an error。but hexo gandhexo s http://localhost:4000/ is ok?

Try the method above plz. Though I can't explain why it works. Maybe it's because hexo 6.2.0 requires the latest version of js-yaml but the module isn't the latest one, which triggers the problem.

leostudiooo avatar Aug 29 '22 13:08 leostudiooo

I tried yarn add js-yaml@latest, and it seems to solve the problem.

Theoretically npm install js-yaml@latest may be ok as well.

Why is version 6.2 still an error。but hexo gandhexo s http://localhost:4000/ is ok?

Try the method above plz. Though I can't explain why it works. Maybe it's because hexo 6.2.0 requires the latest version of js-yaml but the module isn't the latest one, which triggers the problem.

Thank you for your answer But it still gets seven critical bug warnings, Later it was found that there was a problem with uploading one more folder for online use。

Jiangruoye avatar Aug 30 '22 02:08 Jiangruoye

Latest version of HEXO 6.2.0 still fails to start. This workaround resolved it:

npm install [email protected]

lorezyra avatar Sep 03 '22 14:09 lorezyra

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

RonaldJerez avatar Sep 10 '22 01:09 RonaldJerez

  • install hexo 6.0.0
npm i [email protected]
  • replace hexo version 6.1.0 to 6.0.0 in package.json
{
  "hexo": {
    "version": "6.0.0"
  }
}

if still get errors. delete package-lock.json and node_modules then reinstall with npm install [email protected]

fixed workflow https://github.com/dimaslanjaka/dimaslanjaka.github.io/runs/5657131614?check_suite_focus=true

Thanks man, it works

EvanNotFound avatar Oct 14 '22 19:10 EvanNotFound