DeprecationWarning:运行前端服务器时,punycode 模块已被弃用

问题描述 投票:0回答:1

我在运行前端服务器时遇到与 punycode 模块相关的 DeprecationWarning。警告消息是: (节点:6208)[DEP0040] DeprecationWarning:punycode 模块已弃用。请改用用户态替代方案。 当我使用命令 npm run dev 运行前端服务器时,会出现此警告。这是输出的相关部分: [电子邮件受保护] 开发)下一个开发 (节点:6208)[DEP0040] DeprecationWarning:punycode 模块已弃用。请改用用户态替代方案 我已确保所有依赖项都是最新的。尽管如此,我仍然收到弃用警告。该问题似乎源自 MongoDB Node.js 驱动程序及其依赖项。这是导致问题的依赖链: **└─┬ [电子邮件受保护] └─┬ [电子邮件受保护] └─┬ [电子邮件受保护] └─┬ [电子邮件受保护] └── [电子邮件受保护] 对于如何解决此警告并相应更新我的依赖项的任何见解或建议,我将不胜感激。预先感谢您的帮助。 后端package.json: 已将我的 Node.js 版本更新到最新版本,并且我还确保项目中的所有依赖项都是最新的。尽管有这些更新,我在运行前端服务器时仍然遇到与 punycode 模块相关的 DeprecationWarning。

{
  "name": "frontend",
  "version": "0.1.0",
 "private": true,
  "scripts": {
  "dev": "next dev",
  "build": "next build",
  "start": "next start",
  "lint": "next lint"
  },
  "dependencies": {
    "next": "14.1.4",
   "react": "^18",
    "react-dom": "^18",
   "tailwindcss-animate": "^1.0.7",
   "yarn": "^1.22.22"
  },
   "devDependencies": {
 "@types/node": "^20",
   "@types/react": "^18",
  "@types/react-dom": "^18",
  "autoprefixer": "^10.0.1",
  "postcss": "^8",
  "tailwindcss": "^3.3.0",
  "typescript": "^5"
 }
  }
  `{
 "name": "backend",
 "version": "1.0.0",
     "description": "",
    "main": "server.js",
   "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
   "start": "node server.js",
   "dev": "nodemon server.js"
 },
 "keywords": [],
 "author": "",
 "license": "ISC",
 "dependencies": {
  "axios": "^1.6.7",
  "bcrypt": "^5.1.1",
 "cors": "^2.8.5",
 "dotenv": "^16.4.5",
 "express": "^4.18.3",
 "jsonwebtoken": "^9.0.2",
   "mongodb": "^6.4.0",
 "mongoose": "^8.2.1",
   "nodemon": "^3.1.0",
  "validator": "^13.11.0"
 } 
}`
node.js mongodb deprecation-warning punycode
1个回答
0
投票

我在 Nextjs 项目中遇到了同样的问题。

尝试将您的 Node 版本降级到最新的可用 LTS。目前是 v20.12.2.

希望有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.