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

655
Vistas
Error when attempting to include Crypto module: Can't resolve 'crypto'

I am working on a register user setup in React JS, installed crypto library from to secure passwords but when I run the program , it gives me an error :

ERROR in ./node_modules/jwa/index.js 5:13-30

Module not found: Error: Can't resolve 'crypto' in 'E:\Node Tutorial\registerSetup\client\node_modules\jwa'

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.

If you want to include a polyfill, you need to:

  • add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
  • install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }

Here is my package.json file :

         {
          "name": "registerSetup",
          "version": "1.0.0",
          "description": "",
          "main": "index.js",
          "scripts": {
          "start": "NODE_ENV= production node server",
          "dev": "nodemon server"
          },
          "keywords": [],
          "author": "",
          "license": "ISC",
          "dependencies": {
          "body-parser": "^1.19.1",
          "cors": "^2.8.5",
          "crypto": "^1.0.1",
          "crypto-browserify": "^3.12.0",
          "dotenv": "^15.0.0",
          "express": "^4.17.2",
          "express-jwt": "^6.1.0",
          "express-validator": "^6.14.0",
          "google-auth-library": "^7.11.0",
          "jsonwebtoken": "^8.5.1",
          "loadash": "^1.0.0",
          "lodash": "^4.17.21",
          "mongoose": "^6.1.8",
          "morgan": "^1.10.0",
          "node-fetch": "^3.2.0",
          "nodemailer": "^6.7.2",
          "nodemon": "^2.0.15"
          }
         }

The package.json for my react folder in registerSetup --> https://pastebin.com/hqBs7J4s

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

You can try to downgrade the react version to : 4.0.3

about 4 years ago · Juan Pablo Isaza Denunciar

0

Crypto is a built-in Node module you don't have to install it. Uninstall "crypto": "^1.0.1" and then try:

const crypto = require("crypto")
about 4 years ago · Juan Pablo Isaza Denunciar

0

I think you should go to your node_modules/react-scripts/config/webpack.config.json and there write the following code in resolve block

fallback: {
           "crypto": require.resolve("crypto-browserify")
          }  

Note: crypto-browserify should be installed

about 4 years ago · Juan Pablo Isaza 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