DeprecationWarning: The `punycode` module is deprecated.

4,583 阅读1分钟

本地node版本过高!!!

image.png

DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.

(Use node --trace-deprecation ... to show where the warning was created)

image.png

1.在 nodejs v21.0.0 以上会出现如下提示

image.png

解决方法

npm install punycode --save

进入 node_modules

找到 tr46 文件夹中的 index.js

找到下面的代码

var punycode = require("punycode");

image.png

在punycode后面加上/

image.png

var punycode = require("punycode/");
第二种方法更改node版本号:
安装并使用nvm工具

下载安装包

image.png

image.png

image.png

更改node版本号:

例如nvm install node

nvm install 12.17.0

image.png