Node.js 不推荐使用警告:在nodejs中不推荐使用crypto.CreateChipher

Node.js 不推荐使用警告:在nodejs中不推荐使用crypto.CreateChipher,node.js,npm,cryptography,compiler-warnings,Node.js,Npm,Cryptography,Compiler Warnings,我在构建节点服务时收到以下警告 DeprecationWarning: crypto.createCipher is deprecated. 我的服务中安装了加密npm模块 import crypto from 'crypto'; 但问题是,使用crypto.createCipher函数,我的服务中没有任何地方。 我在crypto模块的服务中使用的唯一功能是crypto.randomBytes(32).toString('hex') 我尝试过的 我已尝试用最新版本重新安装加密模块(不修复警告

我在构建节点服务时收到以下警告

DeprecationWarning: crypto.createCipher is deprecated.
我的服务中安装了加密npm模块

import crypto from 'crypto';
但问题是,使用crypto.createCipher函数,我的服务中没有任何地方。 我在crypto模块的服务中使用的唯一功能是
crypto.randomBytes(32).toString('hex')

我尝试过的

我已尝试用最新版本重新安装加密模块(不修复警告)

您不应该使用此npm软件包




修理 您需要使用内置的
crypto
包。不需要安装它。默认情况下,它是内置的

请从您的
包.json中删除
crypto
npm包

npm删除--保存加密

我看到crypto random string模块,它的索引有const crypto=require('crypto');此外,我删除了npm remove--save crypto并从my package.json中删除,但弃用消息仍然存在。在我删除了crypto模块之后,randomBytes生成函数仍在工作,但关于crypto.createCipher已弃用的警告消息仍然存在。您使用的是哪个
节点
版本<代码>节点--版本
我正在使用v12.14.1