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

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

我在我的 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. 

建议切换到“userland-provided”模块。 那是什么?

有一个指向 https://github.com/mathiasbynens/punycode.js 的链接,我尝试将其包含在我的 package.json 中而不是“punycode”中,但我得到了相同的错误。

node.js angular npm yarnpkg punycode
1个回答
3
投票

第一:

npm install punycode --save

第二:

然后在

node_modules
进入目录tr46>index.js

// Replace this:
const punycode = require('punycode');
// With this:
const punycode = require('punycode/');
© www.soinside.com 2019 - 2024. All rights reserved.