正在加载今日诗词....

hexo g 报错[DEP0170] DeprecationWarning

起因

首先是因为在source根目录下创建Ads.txt并发布成功,后来发现应该为小写字母,于是直接修改源文件名为ads.txt,再hexo g,这时候发现报错了,报错如下。而且github上源码Ads名称不变,很奇怪。手动删除或者修改为小写ads还是会变回来。这样想来下面的报错似乎是一直存在并不影响发布文章。

1
2
3
4
5
6
7
8
9
10
11
12
$ hexo g
INFO Validating config
Inferno is in development mode.
INFO =======================================
INFO === Checking package dependencies ===
INFO === Checking theme configurations ===
INFO === Registering Hexo extensions ===
INFO Start processing
Inferno is in development mode.
INFO Files loaded in 1.37 s
(node:50916) [DEP0170] DeprecationWarning: The URL http://localhost:4000),d为发布 is invalid. Future versions of Node.js will throw an error.
(Use `node --trace-deprecation ...` to show where the warning was created)

按照提示输入命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ node --trace-deprecation ...
node:internal/modules/cjs/loader:1145
throw err;
^

Error: Cannot find module 'E:\PortableGit\blog\...'
at Module._resolveFilename (node:internal/modules/cjs/loader:1142:15)
at Module._load (node:internal/modules/cjs/loader:983:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}

Node.js v21.7.0

看来关键是MODULE_NOT_FOUND

分析

目前来看,这个报错是不影响正常部署推送到github的。

针对Ads.txt改名成ads.txt后无法推送到github上的问题,我的解决办法是先本地source文件夹删除后hexo g && hexo d;待github上Ads.txt自动删除后再到本地source文件夹创建ads.txt继续hexo g && hexo d。

解决办法

MODULE_NOT_FOUND还在摸索。。。。有空再搞

hexo g 报错[DEP0170] DeprecationWarning

https://bg4vrg.com/post/20240307095911.html

作者

fei

发布于

2024-03-07

更新于

2024-03-08

许可协议

评论