Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

322
Vistas
Module not found: Error: Can't resolve 'crypto' in

Error Message:

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

So I was googling this issue and had a LOT of problems finding a solution. So i would like to share it with you:

  1. First of all this can happen not only with crypto but other stuff like http, https, os and so on.

  2. Check if the packet (this case crypto-browserify is installed) There should be a folder node_modules\crypto-browserify

If it doesnt exist: npm install crypto browsrify, then yarn add @types/node@15.12.5 -D (for this node version)

In node_modules\crypto-browserify edit package.json and add

 , 
 "optionalDependencies": {},
 "browser": {
   "crypto": false
 },

(after devDependencies)

  1. under tsconfig.json add
"compilerOptions": {
"paths":{
   "crypto":["node_modules/crypto-browserify"],
   "http":["node_modules/stream-http"],
   "https":["node_modules/https-browserify"]
   },
  1. under angluar.json add
"architect": {
   "build": {
   "builder": "@angular-devkit/build-angular:browser",
   "options": {
      "allowedCommonJsDependencies": ["crypto"],
      "allowedCommonJsDependencies": ["http"],
      "allowedCommonJsDependencies": ["https"],
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I had this problem in ReactJS with create-react-app(facebook)

Solution:

  1. First install the necessary packages "crypto-browserify"

  2. Modify webpack.config.js in reactjs with create-react-app this file is inside:

node_modules/react-scripts/config/webpack.config.js

  • Search module.exports and inside this function there is a return:
module.exports = function (webpackEnv) {
  ...
  return {
   ...
    resolve: {
      ...
      fallback: {
        // Here paste
        crypto: require.resolve("crypto-browserify"),

      }
    }
  }
}

Note:Is possible that need more packages, for example "stream-browserify" the steps are same. This solution works, but when the webpack project starts it shows warnings

Pd: I am not native speaker English, but I hope understand me.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda