Home > Back-end >  Error: "Module build failed (from ./node_modules/happypack/loader.js):"
Error: "Module build failed (from ./node_modules/happypack/loader.js):"

Time:05-07

This is the theme I am using for a dashboard project (I am under serious timeline pressure).

https://themeforest.net/item/enlite-prime-reactjs-fullstack-website-template/23803960

But getting the following error after installing node modules and executing npm start.

ERROR in ./app/app.js
Module build failed (from ./node_modules/happypack/loader.js):
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:135:10)
    at filename (/mnt/d/Work/Web Development/Websites/enlite-prime_v19/enlite-prime/node_modules/babel-loader/lib/cache.js:94:23)
    at /mnt/d/Work/Web Development/Websites/enlite-prime_v19/enlite-prime/node_modules/babel-loader/lib/cache.js:122:39
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/mnt/d/Work/Web Development/Websites/enlite-prime_v19/enlite-prime/node_modules/babel-loader/lib/cache.js:3:103)
    at _next (/mnt/d/Work/Web Development/Websites/enlite-prime_v19/enlite-prime/node_modules/babel-loader/lib/cache.js:5:194)
    at /mnt/d/Work/Web Development/Websites/enlite-prime_v19/enlite-prime/node_modules/babel-loader/lib/cache.js:5:364
    at new Promise (<anonymous>)
    at /mnt/d/Work/Web Development/Websites/enlite-prime_v19/enlite-prime/node_modules/babel-loader/lib/cache.js:5:97

CodePudding user response:

This is because of the Node v17 which has a different SSL provider. You can either

  • install Node v16 via nvm and reinstall node_modules (instructions here)
  • run v17 with the legacy openssl provider:
    • Mac/Linux: export NODE_OPTIONS=--openssl-legacy-provider
    • Windows: set NODE_OPTIONS=--openssl-legacy-provider
  • Related