punycode在npm中被弃用-我应该用什么来替换它?

qoefvg9y  于 8个月前  发布在  其他
关注(0)|答案(1)|浏览(223)

我在我的Angular项目中使用了npm模块punycode。VsCode告诉我它已被弃用,https://nodejs.org/api/punycode.html#punycode_punycode确认:

The version of the punycode module bundled in Node.js is being deprecated. In a future major version of Node.js this module will be removed. Users currently depending on the punycode module should switch to using the userland-provided Punycode.js module instead.

字符串
建议是切换到“用户提供”模块。那是什么?
有一个指向https://github.com/mathiasbynens/punycode.js的链接,我试图将其包含在我的package.json instad 'punycode'中,我得到了同样的错误。

kh212irz

kh212irz1#

npm install punycode --保存
第二:然后在node_modules中转到目录tr 46> index.js

// Replace this:
const punycode = require('punycode');
// With this:
const punycode = require('punycode/');

字符串

相关问题