This post records how to resolve warnings and errors encountered during Hexo deployment.

Warnings

warning: LF will be replaced by CRLF in xxx.html.

Cause

Different systems use different end-of-line (EOL) characters. During cross-platform collaboration, the EOL characters may be replaced, leading to differences in whitespace characters (such as spaces, tabs, or line breaks), which triggers this warning.

Chinese Name English Name Abbreviation Escape Symbol ASCII Code
Carriage Return Carriage Return CR \r 0x0D(13)
Line Feed Line Feed LF \n 0x0A(10)

DOS, Windows, WSL

Use both CR (Carriage Return) and LF (Line Feed) characters to end a line: CRLF "\r\n"

Unix, Linux, Mac

Use LF (Line Feed) only to end a line: LF "\n"

Note

In Mac OS prior to OS X, lines ended with "\r". Now, they end with "\n".

git config core.autocrlf

This command sets how Git handles line endings.

There are three options:

true/input/false

git config --global core.autocrlf false

This allows submitting files with mixed line endings without conversion upon commit.

Warning

warning: Accessing non-existent property ‘xxx’ of module exports inside circular dependency

(node:38864) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:38864) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:38864) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:38864) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:38864) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:38864) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency

The Node.js version on my system is v16.13.2.

Solutions Gathered

Solution 1

Downgrade Node.js to version 12.

Uninstall the current Node.js version and install the nvm-windows management tool.

nvm ls available

Check available Node.js versions.

nvm install 12.20.0

Install version v12.20.0 (you can choose any specific version).

nvm ls

View all installed versions.

nvm use 12.20.0

Select the Node.js version to run locally, such as 12.20.0.

Note

nvm uninstall 12.20.0

Uninstall the specified Node.js version.

This method is not a permanent fix, and I haven’t tested it myself.

Solution 2

The warning is caused by slow updates to the stylus/nib package.

Due to historical reasons, Hexo developers cannot abandon the dependency on stylus/nib#350 Currently, there is no better solution, but future versions may resolve this warning.

Error

err: Template render error: (unknown path)
Error: unexpected end of comment

err: Template render error: (unknown path)
    Error: unexpected end of comment
      at Object._prettifyError (C:\Users\ba2in9a\Documents\blog\node_modules\nunjucks\src\lib.js:36:11)
      at Template.render (C:\Users\ba2in9a\Documents\blog\node_modules\nunjucks\src\environment.js:538:21)
      at Environment.renderString (C:\Users\ba2in9a\Documents\blog\node_modules\nunjucks\src\environment.js:380:17)
      at C:\Users\ba2in9a\Documents\blog\node_modules\hexo\lib\extend\tag.js:236:16
      at tryCatcher (C:\Users\ba2in9a\Documents\blog\node_modules\bluebird\js\release\util.js:16:23)

Cause

This error occurs when there is an unclosed #} outside of a code block in the post content, causing a template rendering error.

Solution

Either enclose the #} in a code block or remove it.