7

I found this error when I tried to run an angular application. Any tip?

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:135:10)
at module.exports 



Error: Cannot find module '/home/isaac-wahba/Development/Personal/Udacity/Deployment/deployment-process-project/udagram/udagram-frontend/–openssl-legacy-provider'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v17.4.0

Note: I tried the following:

  • Changing the Webpack version to 4.39.2
  • Changing it to 5.61.0.
  • The result was
 An unhandled exception occurred: Cannot find module 'webpack/lib/ParserHelpers'
Isaac Wahba
  • 101
  • 1
  • 1
  • 5

2 Answers2

31

Windows: set NODE_OPTIONS=--openssl-legacy-provider

Mac/Linux: export NODE_OPTIONS=--openssl-legacy-provider

Add the set NODE_OPTIONS=--openssl-legacy-provider && in your scripts start command.

For example your previous script like:

"scripts": {
  "start": "ng serve"
}

Then after you have

"scripts": {
  "start": "set NODE_OPTIONS=--openssl-legacy-provider && ng serve"
}

Then run npm start

James Skemp
  • 8,018
  • 9
  • 64
  • 107
Peter.Wang
  • 2,051
  • 1
  • 19
  • 13
3

I solve it by changing:

  1. node version to 16.
  2. webpack version to 4.
Elikill58
  • 4,050
  • 24
  • 23
  • 45
Isaac Wahba
  • 101
  • 1
  • 1
  • 5
  • tried a lot of things, this was the only one that worked – Jude Okoroafor Feb 10 '22 at 11:43
  • I ended up installing nvm for Windows so that I could try various versions of Node to correct this issue. Highly recommend! Here's the link: https://github.com/coreybutler/nvm-windows#node-version-manager-nvm-for-windows – Paul Maurer Jan 13 '23 at 16:53