hexo: Regression in Node 14

Noticed this issue on my blog, Netlify doesn’t upload any file after upgrading Node 14 (build log), and led to an empty site.

A working workaround is to downgrade; I downgraded to Node 12, my blog never had any issue with Node 13, so it looks like a Node 14 issue.

I can replicate this issue in https://github.com/hexojs/site/pull/1395, site does become empty.


Replicated the issue in my workstation, with a dummy blog (default plugins only). /public folder has all the files, but they are all empty.

  • Install node_modules with Node 14, run Hexo with Node 14: ❌
  • Install node_modules with Node 13, run Hexo with Node 14: ❌
  • Install node_modules with Node 13, run Hexo with Node 13: ✅
  • Install node_modules with Node 14, run Hexo with Node 13: ✅

Node 13 is v13.13.0, Node 14 is v14.0.0

@hexojs/core


Tested packages:

hexohexo-fshexo-cli

warehousehexo-renderer-nunjuckshexo-renderer-markedhexo-utilhexo-generator-feed.


Edit (30 April 2020): fix released in hexo-util@2.0.0 and hexo-fs@3.0.0.

There are two options to temporarily fix compatibility issues with Node 14:

  1. Downgrade to Node 10 or 12. If you use .nvmrc as part of your CI workflow, you need to change the content to 10 or 12.
  2. If you prefer to use Node 14, force upgrade hexo-util and hexo-fs:
{
  ...
  "dependencies": {
    "hexo": "^4.0.0",
    "hexo-generator-archive": "^1.0.0",
    "hexo-generator-category": "^1.0.0",
    "hexo-generator-index": "^1.0.0",
    "hexo-generator-tag": "^1.0.0",
    "hexo-renderer-ejs": "^1.0.0",
    "hexo-renderer-stylus": "^1.1.0",
    "hexo-renderer-marked": "^2.0.0",
    "hexo-server": "^1.0.0",
+    "hexo-util": "^2.1.0",
+    "hexo-fs": "^3.0.1"
  }
}
$ rm -rf node_modules/
$ npm install

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 7
  • Comments: 21 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@LeoEatle @Rapiz1 @dumindu @yangxyo @luisleee

We published v4.2.1. v4.2.1 has included fixed compatible with Node 14.

Thanks 😃

When will a version compatible with node 14 release?

@curbengh

I suggest to add { "engines" : { "node" : ">=8.10.0 <14" } } to Hexo 4.2.1

However there are already many features merged into master branch. Should we released a 4.3.0. though?

@dumindu You can reinstall it. It can work on v12.16.3 on my machine.

Since the fixes won’t be backported to Hexo 4, I suggest to add { "engines" : { "node" : ">=8.10.0 <14" } } to Hexo 4.2.1. Note that recent npm versions will only show warning but doesn’t stop installation in incompatible Node.

If user wants to go ahead with Hexo 4 + Node 14, the fix is to install hexo-util v2 and hexo-fs v3.

Yes, it seems that most of the error messages come from this commit

nodejs/node@a13500f#diff-0034beae2e92ed0b59570df638dda305