Thanks to visit codestin.com
Credit goes to github.com

Skip to content

nodejs 17: digital envelope routines::unsupported #14532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
akornatskyy opened this issue Oct 19, 2021 · 300 comments · Fixed by #14584
Closed

nodejs 17: digital envelope routines::unsupported #14532

akornatskyy opened this issue Oct 19, 2021 · 300 comments · Fixed by #14584

Comments

@akornatskyy
Copy link

Bug report

What is the current behavior?

[webpack-cli] 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

@alexander-akait
Copy link
Member

alexander-akait commented Oct 19, 2021

Why do you ignore reproducible repo? What is output.hashFunction/output.hashDigest and etc? I see...

@alexander-akait
Copy link
Member

nodejs/node#40455

@akornatskyy
Copy link
Author

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

@zloirock
Copy link

The same situation is also with webpack@4. I hope that it will be fixed in the legacy versions too since I'm blocked to use the actual webpack versions in legacy projects due to the requirement of the support of old NodeJS versions.

@alexander-akait
Copy link
Member

Yes, marked as critical

@sokra
Copy link
Member

sokra commented Oct 20, 2021

The same situation is also with webpack@4. I hope that it will be fixed in the legacy versions too since I'm blocked to use the actual webpack versions in legacy projects due to the requirement of the support of old NodeJS versions.

We will not update that in webpack 4.

@alexander-akait
Copy link
Member

For webpack 4 solutions:

  • export NODE_OPTIONS=--openssl-legacy-provider
  • monkey patching crypto for md4 and Node.js v17

@sokra
Copy link
Member

sokra commented Oct 20, 2021

hmm... We can't really automatically fallback to a different hashing algorithm, since this would break the determinism of builds (builds should be equal independent of node.js version).

We are planning to migrate to a different hash function anyway for webpack 6. So currently you will have to use output.hashFunction: "xxhash64" in configuration to fix that. Or --openssl-legacy-provider

Seems like the need to release a new major becomes more pressing...

@alexander-akait
Copy link
Member

alexander-akait commented Oct 20, 2021

To be honestly it is very strange from Node.js developers, no deprecation messages, they just remove it... and break a lot of packages

@MaxGraey
Copy link

MaxGraey commented Oct 20, 2021

To be honestly it is very strange from Node.js developers, no deprecation messages, they just remove it... and break a lot of packages

node.js 17 uses OpenSSL3 which have changed code for initialization context of md family (including md4):
https://wiki.openssl.org/index.php/OpenSSL_3.0#Upgrading_to_OpenSSL_3.0_from_OpenSSL_1.0.2

But I agree that node.js could have warned you in advance, given that you are one of the biggest consumers.

@FSM1
Copy link

FSM1 commented Oct 22, 2021

workaround:

export NODE_OPTIONS=--openssl-legacy-provider

where should this be added?

@akornatskyy
Copy link
Author

akornatskyy commented Oct 22, 2021

@FSM1 : if you use bash or related just execute that before you work with webpack.

@krisnaRusdiono
Copy link

krisnaRusdiono commented May 27, 2024

In my experience, this issue is occur when i tried to serve angular app (mine is v11.0.0) with node 18.19.1.
I might suggest people who try

export NODE_OPTIONS=--openssl-legacy-provider (macOS)
or
set NODE_OPTIONS=--openssl-legacy-provider (windows)

and still failing, try to switch your node version to 16.XX.X (mine is 16.20.2). Switching node version is always work for me to resolve this issue (i run many version of multi project with different angular version).
(use nvm) for managing your node version is recommended!

@Sinc63
Copy link

Sinc63 commented Aug 19, 2024

The same situation is also with webpack@4. I hope that it will be fixed in the legacy versions too since I'm blocked to use the actual webpack versions in legacy projects due to the requirement of the support of old NodeJS versions.

We will not update that in webpack 4.

It appears that a "fix" for this HAS been applied to webpack@4. #17628 changed the code so that effectively calls to crypto.createHash("md4") circumvent the crypto package that generates the error, and directly call underlying functions that implement md4. Switch to [email protected] to see the result.

@martinellison
Copy link

martinellison commented Aug 31, 2024

I'm still getting this error, so why is it closed? I have just followed the tutorial in https://rustwasm.github.io/docs/book/game-of-life/hello-world.html (I used cargo install wasm-pack) and I got this error when I ran npm run start. Should I be using a development version from github?

edit: OK, the NODE_OPTIONS fix works for me

@Ohiekkar
Copy link

Dropping a comment here just in case someone else still runs into similar issues.

We were suddenly getting these errors on Node.js 16.20.2 and Webpack 4.47.0 after switching OS from Centos 7 to Rocky Linux 9. Turns out that the Node 16.20.2 available in the Rocky Linux 9 repo includes backports to the SSL vulnerability fixes that cause these errors in the first place.

The fix that was made into Webpack to make it work with Node >=18 explicitly check that the running node version is 18 or higher, thus it wont work with the patched Node v16 that Rocky Linux provides.

Our fix was simply to update to Node >=18.

pan3793 pushed a commit to apache/zeppelin that referenced this issue Sep 30, 2024
…eb-angular`

### What is this PR for?
Specify the Node.js engine version below 17 in the `zeppelin-web-angular` package.json file to avoid errors related to Node.js 17+ and OpenSSL in Webpack.

If we upgrade the Angular version to 13+ in the future, we will be able to use Node.js 17+ as well.

[Reference: nodejs 17: digital envelope routines::unsupported · Issue #14532 · webpack/webpack](webpack/webpack#14532)

### What type of PR is it?
Improvement

### Todos

### What is the Jira issue?
* [ZEPPELIN-6110]

### How should this be tested?
1. Set your Node.js version to 17+
2. Execute `npm run postinstall` in `zeppelin-web-angular`

### Screenshots (if appropriate)

### Questions:
* Does the license files need to update? N
* Is there breaking changes for older versions? N
* Does this needs documentation? N


Closes #4848 from seung-00/ZEPPELIN-6110.

Signed-off-by: Cheng Pan <[email protected]>
pan3793 pushed a commit to apache/zeppelin that referenced this issue Sep 30, 2024
…eb-angular`

### What is this PR for?
Specify the Node.js engine version below 17 in the `zeppelin-web-angular` package.json file to avoid errors related to Node.js 17+ and OpenSSL in Webpack.

If we upgrade the Angular version to 13+ in the future, we will be able to use Node.js 17+ as well.

[Reference: nodejs 17: digital envelope routines::unsupported · Issue #14532 · webpack/webpack](webpack/webpack#14532)

### What type of PR is it?
Improvement

### Todos

### What is the Jira issue?
* [ZEPPELIN-6110]

### How should this be tested?
1. Set your Node.js version to 17+
2. Execute `npm run postinstall` in `zeppelin-web-angular`

### Screenshots (if appropriate)

### Questions:
* Does the license files need to update? N
* Is there breaking changes for older versions? N
* Does this needs documentation? N

Closes #4848 from seung-00/ZEPPELIN-6110.

Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit 17e1e73)
Signed-off-by: Cheng Pan <[email protected]>
@Wissaladd
Copy link

Wissaladd commented Nov 10, 2024

In my case I just wanted to fix this problem for a specific project since my other projects rely on Node17 and i cannot downgrade
my packageJson has "dev": " webpack-dev-server --watch --config webpack.config.dev.js", since my problem was while using yarn dev so i replaced it with this "dev": "NODE_OPTIONS=--openssl-legacy-provider webpack-dev-server --watch --config webpack.config.dev.js",
I have Node18 and yarn4 if you're wondering

@devsheva
Copy link

the NODE_OPTIONS works for me, but without it i keep getting the problem even if with Node22

xcarol added a commit to xcarol/xicra that referenced this issue Nov 28, 2024
Oleksandr0305 added a commit to Oleksandr0305/react-rails that referenced this issue Feb 1, 2025
denys603 pushed a commit to denys603/chrome-extension-typescript that referenced this issue Feb 9, 2025
When using latest node, webpack produces an error,

Error: error:0308010C:digital envelope routines::unsupported

webpack/webpack#14532

This is due to the webpack version being 5.53.0 when running npm install.  The error is fixed in 5.61.0 by the following merged pull request,

webpack/webpack#14584

https://github.com/webpack/webpack/releases/tag/v5.61.0

When I set 5.61.0 as the minimum I now get 5.72.0 version which is latest. Build completes without error.
@pvspain
Copy link

pvspain commented Feb 25, 2025

the NODE_OPTIONS works for me, but without it i keep getting the problem even if with Node22

NODE_OPTIONS does NOT work for me...

  • node 22.14.0 (LTS)
"start": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
"build": "set NODE_OPTIONS=--openssl-legacy-provider && react-scripts build",

Please reopen this ticket

@LoganTann
Copy link

I can confirm the issue now reappears in node 22.

@EthanDarling8
Copy link

Also reappeared for me using node 22.14.0

1 similar comment
@patiltukaram
Copy link

Also reappeared for me using node 22.14.0

@alexander-akait
Copy link
Member

We don't use md4 built-in hashes in webpack@5, check your webpack version and look at trace this error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet