问题复现

使用HEXO部署时,控制台输出警告

1
2
3
4
5
6
7
(node:18256) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:18256) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:18256) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:18256) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:18256) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:18256) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency

错误原因

Stylus与Node版本不兼容
参考: https://github.com/stylus/stylus/pull/2538

npm ls stylus输出如下,hexo使用的是0.54.7版本

1
2
3
4
└─┬ [email protected]
├─┬ [email protected]
│ └── [email protected]
└── [email protected]

解决方法

参考:https://github.com/stylus/stylus/pull/2538/commits/16e2a6c6f96f80b0d700411879f1c13991a0a1a5

Stylus0.54.8及以上版本被修复

升级HEXO使用的hexo-renderer-stylus为最新版

1
yarn upgrade hexo-renderer-stylus