问题
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';
but still I am getting error that is
`ERROR in src/app/log-in/log-in.component.ts(11,25): error TS2307: Cannot find module 'crypto'.`
Please help me to resolve the error that how to use this library into Angular.
Thanks in Advance.
回答1:
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.
回答2:
Make sure that you install 'crypto' module from npm
use: npm i crypto
to install this module.
for more information please visit here.
If this is still not working then you have to check for alternative module because this module is dedicated you can check this
来源:https://stackoverflow.com/questions/54555730/getting-error-cannot-find-module-crypto