收到错误找不到模块“ crypto” [英] Getting error Cannot find module 'crypto'
问题描述
我正在尝试使用Angular 7中的节点加密模块进行非对称加密。
,并在下面的命令中用于导入加密模块
I am trying to use node Crypto module in Angular 7 for asymmetric encryption. and used below command to import the Crypto module
import * as crypto from 'crypto';
但仍然出现错误
`ERROR in src/app/log-in/log-in.component.ts(11,25): error TS2307: Cannot find module 'crypto'.`
请帮助我解决如何使用此库转换为Angular的错误。
Please help me to resolve the error that how to use this library into Angular.
预先感谢。
推荐答案
根据npm的作者,不再提供加密软件包,因为现在已内置到Node.js中。我建议寻找替代方案。我遇到了包含一些建议的Github要点: https://gist.github.com/jo/8619441
Per the author on npm , The crypto package is no longer available as it is now built in to Node.js. I would suggest looking for an alternative. I came across a Github Gist that contains some suggestions: https://gist.github.com/jo/8619441
请确保您选择的内容在浏览器中都可用。其中列出的某些选项仅在服务器端。
Make sure whatever you pick is useable in the browser. Some of the options listed there are server-side only.
这篇关于收到错误找不到模块“ crypto”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!