manks
January 16, 2022, 1:27am
1
opened 06:33PM - 19 Oct 21 UTC
closed 08:58PM - 28 Oct 21 UTC
webpack-4
webpack-5
critical-bug
# Bug report
**What is the current behavior?**
```sh
[webpack-c… li] Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at BulkUpdateDecorator.hashFactory (/opt/src/node_modules/webpack/lib/util/createHash.js:155:18)
at BulkUpdateDecorator.digest (/opt/src/node_modules/webpack/lib/util/createHash.js:80:21)
at /opt/src/node_modules/webpack/lib/DefinePlugin.js:595:38
at Hook.eval [as call] (eval at create (/opt/src/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:100:1)
at Hook.CALL_DELEGATE [as _call] (/opt/src/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/opt/src/node_modules/webpack/lib/Compiler.js:1053:26)
at /opt/src/node_modules/webpack/lib/Compiler.js:1097:29
at Hook.eval [as callAsync] (eval at create (/opt/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
```
**Other relevant information:**
webpack version: 5.59.0
Node.js version: 17.0.0
Operating System: linux x64
Apparently the work around is adding NODE_OPTIONS=--openssl-legacy-provider
to your scripts, like such:
"scripts": {
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack --env.production --extractCss",
"start": "NODE_OPTIONS=--openssl-legacy-provider webpack-dev-server --extractCss",
"build:dev": "NODE_OPTIONS=--openssl-legacy-provider webpack --extractCss",
"analyze": "NODE_OPTIONS=--openssl-legacy-provider webpack --env.production --analyze",
"test": "NODE_OPTIONS=--openssl-legacy-provider au test",
"e2e": "NODE_OPTIONS=--openssl-legacy-provider au cypress --run",
"e2e:headless": "NODE_OPTIONS=--openssl-legacy-provider au cypress --start --run"
},
Is there a better way, like adding something to webpack or Aurelia’s config file?
manks
January 16, 2022, 11:12pm
2
I just updated to Webpack 5.
Yes, I ran into the same ERR_OSSL_EVP_UNSUPPORTED error with Node 17. It’s caused by changes in OpenSSL 3, which Node 17 uses. A simple fix is to switch to Node.js 16.x LTS, which still uses OpenSSL 1.1 and doesn’t trigger this error. You can manage versions easily using nvm (Node Version Manager).
Hope it helps!