hust-open-atom-club / hust-mirrors

华中科技大学开源镜像站前端
https://mirrors.hust.edu.cn
MIT License
60 stars 13 forks source link

启动 Docusaurus 开发服务器时出现 punycode 模块弃用警告 #82

Open ywh555hhh opened 2 weeks ago

ywh555hhh commented 2 weeks ago

问题描述

在运行 yarn start 命令启动 Docusaurus 开发服务器时,出现以下警告信息:

(node:38404) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/

使用 --trace-deprecation 选项运行命令后,显示了详细的堆栈跟踪信息:

node --trace-deprecation $(yarn bin)/docusaurus start
(node:49996) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:398:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:337:10)
    at loadBuiltinModule (node:internal/modules/helpers:96:7)
    at Module._load (node:internal/modules/cjs/loader:1063:17)
    at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
    at Module.require (node:internal/modules/cjs/loader:1297:12)
    at require (node:internal/modules/helpers:123:16)
    at Object.<anonymous> (/Users/yiweihan/Documents/iamProgramer/hust-mirrors/node_modules/fast-url-parser/src/urlparser.js:401:16)
    at Module._compile (node:internal/modules/cjs/loader:1460:14)
[INFO] Starting the development server...
[SUCCESS] Docusaurus website is running at: http://localhost:3000/
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme

✔ Client
  Compiled successfully in 2.67s

client (webpack 5.86.0) compiled successfully

复现步骤

  1. 打开终端并导航到项目目录。
  2. 运行 yarn start 命令。
  3. 观察终端输出的警告信息。

预期行为

开发服务器应正常启动,并且不应出现任何弃用警告。

实际行为

尽管开发服务器成功启动,但出现了以下弃用警告:

(node:38404) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.

环境信息

jxlpzqc commented 2 weeks ago

可以 pull 到 master 最新 commit 并删除 node_modules 重新再尝试一下,目前 docusaurus 已升级到最新版本,不知道该 warning 是否存在。

mudongliang commented 2 weeks ago

@ywh555hhh 请帮忙测试一下当前master分支是否已经没有这个问题了,谢谢

ywh555hhh commented 2 weeks ago

我注意到在使用最新版本的 Docusaurus(3.5.2)和 Node.js 时,仍然会出现 punycode 模块的弃用警告。经过进一步调查,我发现这个问题已经在其仓库里 Issue #10107 中进行了详细讨论。

根据该 Issue 的讨论,官方计划在即将发布的 4.0 版本中修复这个问题。然而,目前 4.0 版本尚未发布,因此这个警告仍然存在。

mudongliang commented 1 week ago

让我们保持这个 issue open,直到我们最终解决这个问题