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.
node_modules with Node 14, run Hexo with Node 14: :x:node_modules with Node 13, run Hexo with Node 14: :x:node_modules with Node 13, run Hexo with Node 13: :white_check_mark:node_modules with Node 14, run Hexo with Node 13: :white_check_mark:Node 13 is v13.13.0, Node 14 is v14.0.0
@hexojs/core
Tested packages:
:x: hexo
:x: hexo-fs
:x: hexo-cli
:white_check_mark: warehouse
:white_check_mark: hexo-renderer-nunjucks
:white_check_mark: hexo-renderer-marked
:white_check_mark: hexo-util
:white_check_mark: hexo-generator-feed.
Edit (30 April 2020): fix released in [email protected] and [email protected].
There are two options to temporarily fix compatibility issues with Node 14:
.nvmrc as part of your CI workflow, you need to change the content to 10 or 12.``` diff package.json
{
...
"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",
$ rm -rf node_modules/
$ npm install
```
In Node.js v14 the [email protected] returns an empty array.
Node.js v14 has many changes about stream. I think this issue caused by these changes.
OK. I found this document transform.destroy([error])
Implementors should not override this method, but instead implement readable._destroy(). The default implementation of _destroy() for Transform also emit 'close' unless emitClose is set in false.
But, hexo-util@ChachStream seems override destory method. Is this correct?
Node.js v14 has many changes about stream. I think this issue caused by these changes.
I looked around the https://github.com/nodejs/node PRs, the stream changes already included on Node 13, but all hexo-related packages have no issue with it.
https://github.com/hexojs/hexo/issues/4257 This problem is also caused by v14
It seems that all problem is related with hexo-fs:
init test.writeFIle, watch and publish, which is also related with fs.Yes, it seems that most of the error messages come from this commit
nodejs/node@a13500f#diff-0034beae2e92ed0b59570df638dda305
The fix has already implemented in https://github.com/hexojs/hexo-fs/pull/60
Tests show that cacheStream.destroys in Node.js 14 will be triggered twice, which causes all content to be empty.
Renaming these two destroy methods can solve the problem.
https://github.com/hexojs/hexo-util/blob/31f74a5296d74339b76909a05ee38d8bb38560bf/lib/cache_stream.js#L21
https://github.com/hexojs/hexo/blob/b60f815b975178ee1c907a92e5a1403830e56f37/lib/plugins/console/generate.js#L68
OK. I found this document transform.destroy([error])
Implementors should not override this method, but instead implement readable._destroy(). The default implementation of _destroy() for Transform also emit 'close' unless emitClose is set in false.
But, hexo-util@ChachStream seems override
destorymethod. Is this correct?
Tests show that
cacheStream.destroysin Node.js 14 will be triggered twice, which causes all content to be empty.
Renaming these twodestroymethods can solve the problem.
What if the following lines are removed so that cacheStream.destroy() is equivalent to Transform.destroy()?
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.
@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?
I met the same issue.
Now I change travis.yml to
node_js: 13.2.0
However there are already many features merged into
masterbranch. Should we released a4.3.0.though?
I mean a single patch on top of https://github.com/hexojs/hexo/commit/c0bf22284c0c2e85bcd5c94b11823d86a0072035 tagged with 4.2.0. See https://github.com/hexojs/hexo/pull/4285.
Other merged changes on top of that commit should be part of 5.0.0, I think some breaking changes are already merged.
@luisleee circular dependencies are caused by stylus, not Hexo.
When will a version compatible with node 14 release?
I tried even with old node versions like v12 but still facing issues. Can't we release a hot fix for this?
I tried even with old node versions like v12 but still facing issues. Can't we release a hot fix for this?
Please run:
node --version
to show your node version.
@yangxyo Tried both v12.5.0 and v12.16.3 as well. It generates empty files with partial template block codes. You can try https://github.com/hexojs/site
@dumindu You can reinstall it. It can work on v12.16.3 on my machine.
Oops, my mistake. Looks like my current issue is due to https://github.com/hexojs/site/issues/1410 . Fixed. Thanks everyone :)
@LeoEatle @Rapiz1 @dumindu @yangxyo @luisleee
We published v4.2.1.
v4.2.1 has included fixed compatible with Node 14.
Thanks :)
Most helpful comment
@LeoEatle @Rapiz1 @dumindu @yangxyo @luisleee
We published v4.2.1.
v4.2.1 has included fixed compatible with Node 14.
Thanks :)