webpack: nodejs 17: digital envelope routines::unsupported
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
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 409
- Comments: 288 (40 by maintainers)
Links to this issue
- node.js - Error message "error:0308010C:digital envelope routines::unsupported" - Stack Overflow
- Fix qa-frontend-node:latest CI build (!78042) · Merge requests · GitLab.org / GitLab · GitLab
- Trying to run yarn but getting 'error:0308010C:digital envelope routines::unsupported'
- Trying to run yarn but getting 'error:0308010C:digital envelope routines::unsupported'
Commits related to this issue
- fix `core-js-builder` work in NodeJS 17, add a workaround of `webpack` + NodeJS 17 issue https://github.com/webpack/webpack/issues/14532 — committed to zloirock/core-js by zloirock 3 years ago
- webpack/webpack#14532 Modified development and production script to fix webpack error. — committed to adedayomatt/eskimi-ssp by adedayomatt 3 years ago
- install mobx and resovle issue:https://github.com/webpack/webpack/issues/14532 — committed to chenxiaorui/MobxSamples by deleted user 3 years ago
- Add Node 17 to the build matrix Modify the build matrix to add Node 17 to the environments under test. The GCC setup from Node 16 is reused here. As a workaround for a bug caused by Node 17 switchin... — committed to appsignal/appsignal-nodejs by unflxw 3 years ago
- Add Node 17 to the build matrix Modify the build matrix to add Node 17 to the environments under test. The GCC setup from Node 16 is reused here. As a workaround for a bug caused by Node 17 switchin... — committed to appsignal/appsignal-nodejs by unflxw 3 years ago
- Add Node 17 to the build matrix Modify the build matrix to add Node 17 to the environments under test. The GCC setup from Node 16 is reused here. As a workaround for a bug caused by Node 17 switchin... — committed to appsignal/appsignal-nodejs by unflxw 3 years ago
- fix(webpack): update, format & ensure node 17 compatibility for reference https://github.com/webpack/webpack/issues/14532 — committed to tobua/papua by tobua 3 years ago
- limit node version due to bug. See @https://github.com/webpack/webpack/issues/14532 — committed to Akmalhakimteo/URL_Shortener by Akmalhakimteo 3 years ago
- limit node version due to bug. See @https://github.com/webpack/webpack/issues/14532 — committed to Akmalhakimteo/URL_Shortener by Akmalhakimteo 3 years ago
- workaround according to https://github.com/webpack/webpack/issues/14532 — committed to mruoss/jasstafel by deleted user 3 years ago
- Work around webpack bug https://github.com/webpack/webpack/issues/14532#issuecomment-951378874 — committed to mozilla-iam/dino-park-front-end by bkochendorfer 3 years ago
- fix(node): add workaround for webpack and node 17 issue. ref https://github.com/webpack/webpack/issues/14532 — committed to clippingkk/web by AnnatarHe 3 years ago
- chore(static): fix ERR_OSSL_EVP_UNSUPPORTED build error https://github.com/webpack/webpack/issues/14532 — committed to isard-vdi/isard by sim6 3 years ago
- Bygg med node:lts https://github.com/webpack/webpack/issues/14532#issuecomment-953599065 — committed to askildolsen/dataplattform by askildolsen 3 years ago
- Bygg med node:lts https://github.com/webpack/webpack/issues/14532#issuecomment-953599065 — committed to digitalisert/dataplattform by askildolsen 3 years ago
- Fix webpack build error See https://github.com/webpack/webpack/issues/14532 — committed to kdeloach/react-lineto by kdeloach 3 years ago
- Fix digital envelope routines::unsupported Error See [wepback #14532](https://github.com/webpack/webpack/issues/14532) — committed to evanugarte/LAN-File-Transfer by evanugarte 3 years ago
- Fix digital envelope routines::unsupported Error See [wepback #14532](https://github.com/webpack/webpack/issues/14532) — committed to evanugarte/LAN-File-Transfer by evanugarte 3 years ago
- Fix digital envelope routines::unsupported Error (#116) See [wepback #14532](https://github.com/webpack/webpack/issues/14532) — committed to evanugarte/LAN-File-Transfer by evanugarte 3 years ago
- webpack docker fix; https://github.com/webpack/webpack/issues/14532 — committed to faiqsohail/DevsMake by faiqsohail 3 years ago
workaround:
where should this be added?
To be honestly it is very strange from Node.js developers, no deprecation messages, they just remove it… and break a lot of packages
We will not update that in webpack 4.
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…
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.
I have replaced in package.json of the project:
with:
It worked
For webpack 4 solutions:
export NODE_OPTIONS=--openssl-legacy-provider
crypto
formd4
and Node.js v17@FSM1 : if you use
bash
or related just execute that before you work with webpack.Why do you ignore reproducible repo? What isI see…output.hashFunction
/output.hashDigest
and etc?@csvan I think it affects mostly people using
docker
and using thenode
image without any tag (latest
by default). The fix is simple, just usenode:lts
insteadthis error can be solved by using stable version of nodejs
Windows:
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 actualwebpack
versions in legacy projects due to the requirement of the support of old NodeJS versions.I don’t like that this issue is closed with a workaround. As more systems move over to OpenSSL 3 only (such is the case here on Fedora 36), more people will experience this issue.
Libraries like Nuxt 2 still only support Webpack 4, and with Nuxt 3 still in beta, it’ll be a while before everyone migrates their projects over to Nuxt 3, and you can’t simply cram Webpack 5 into Nuxt 2 as it’s too tightly integrated.
IMO Webpack 4 should be retroactively fixed to use MD5 hashing, even if there’s no security issue with using MD4 in its context. MD4 has been known to be broken since around '95, the Node team was right to deprecate it, and now it won’t work even on a compatible Node version on systems that are too new. I think being able to work at all is more important than not breaking the determinism of builds.
Neither of those solutions are possible here. Downgrading OpenSSL breaks Fedora 36, and Nuxt 2 can’t be upgraded to use Webpack 5.
https://www.mail-archive.com/devel@lists.fedoraproject.org/msg171436.html
Thank you for this solution! I got it to work with create-react-app by using the following:
package.json:
For example, I was running into this issue when running
gatsby build
, so adding this to my NPMbuild
script fixed the issue:That’s maybe gonna work on Linux base OS. for Windows OS you need add
{ "scripts": { "build": "set NODE_OPTIONS=--openssl-legacy-provider & gatsby build" } }
one of the most disgusting bug
God help anyone who’s read this far, but
output.hashFunction: "xxhash64"
wasn’t working for me either.Ends up, I was using
babel-loader: 8.2.2
which emits the same error (even has webpack in the stack trace). This is because it usedmd4
which is no longer available innode 18
. Solved it by upgrading tobabel-loader: 8.3.0
.imo node could do a lot better with their error message… at least list what type was requested and when it was deprecated.
export NODE_OPTIONS=–openssl-legacy-provider
is a workaround and not a solution
if you are using docker, you can switch from
node:latest
tonode:lts
as a workaround until we get the new webpack version with the fixThis one also works
SOLUTION for React, Vue, Nuxt and Next
Use Node version lower than 17.0.0. And wait for the fix.
Also got this error
(I got the "Error: error:0308010C:digital envelope routines::unsupported")
after just creating a new project with React or Vue:Node.js v17.0.1 NPM v8.1.0 Windows 10 Latest
I just got this error from my other projects too after updating Node to 17.0.1 and NPM to 8.10. Probably has something to do with Node version.
REPRODUCTION
Also happens in Nuxt.js.
Full error:
This work for me :
“scripts”: { “start”: “react-scripts --openssl-legacy-provider start”, “build”: “react-scripts --openssl-legacy-provider build”, }
Yes indeed, CRA is actually the source of my problem, but I did find this solution:
Just change the
npm start
script inpackage.json
from:to:
this has been fixed with release v5.61.0.
@romellem that would not work… if you want to have this as a part of your npm script you need:
This is the workaround, i found. Just add “–openssl-legacy-provider” in the package.json under scripts.
With respect, you could at least try looking if people have not posted at least 20 workarounds in the 600+ comments before yours.
Where does this go?
Edit. Successful example discovered with Nextjs in the Package.json file:
If you’re coming from Docker, add
ENV NODE_OPTIONS=--openssl-legacy-provider
toDockerfile
this does not work for me
https://github.com/webpack/webpack/releases/tag/v5.61.0
cross-env
is most used for this.cross-env
works for all os! 🎉
WebStorm 2023.2.5 Node v20.10.0
Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:68:19) at Object.createHash (node:crypto:138:10) at module.exports (C:\projects\character-creator\node_modules\webpack\lib\util\createHash.js:135:53) at NormalModule._initBuildHash (C:\projects\character-creator\node_modules\webpack\lib\NormalModule.js:417:16) at C:\projects\character-creator\node_modules\webpack\lib\NormalModule.js:452:10 at C:\projects\character-creator\node_modules\webpack\lib\NormalModule.js:323:13 at C:\projects\character-creator\node_modules\loader-runner\lib\LoaderRunner.js:367:11 at C:\projects\character-creator\node_modules\loader-runner\lib\LoaderRunner.js:233:18 at context.callback (C:\projects\character-creator\node_modules\loader-runner\lib\LoaderRunner.js:111:13) at C:\projects\character-creator\node_modules\babel-loader\lib\index.js:59:103 { opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ], library: ‘digital envelope routines’, reason: ‘unsupported’, code: ‘ERR_OSSL_EVP_UNSUPPORTED’
The correct solution is to upgrade to webpack 5 (along with compatible plugins and loaders). Trying to revert the OpenSSL config change is insecure.
On PowerShell
$env:NODE_OPTIONS = "--openssl-legacy-provider"
Worked with Node v18.7.0
nope. even with node v16.14.1 and webpack 4.46
I have found that this error can happen for nodejs 16 if your system only has openssl 3.x installed. This is the case with centos stream 9.
If your system does not have openssl 1.1.x, the problem will happens with webpack less than 5.61.0.
Also, the workaround will not work either:
In this case, the only option seems to be to downgrade openssl on your system (if it is even possible) or upgrade webpack.
@Vinchenzo98 if you are using Unix, you can run the cmd in your shell prompt or you can add it to your .bashrc so it is loaded everytime you open a shell.
If you are using windows, use @vaelsy’s method and edit your package.json to set the environment variable before running your start command. It will not look exactly like this but you should get the idea (I feel like the & should be &&, but I’m not sure):
The latest webpack 5 version does no longer use the native md4 from crypto but a wasm implementation instead.
The same is true for the latest loader-utils version.
We do not plan to backport that to webpack 4. Please upgrade to webpack 5 instead (or don’t upgrade node.js).
If your using
Docker
for your build process insert this environment variable and it will work.Did you read posts above? Ppls were posted solution 10 times. You need to run nodejs with --legacy-ssl option or configure your webpack to use xxhash.
On 24.10.2021 15:14, Nirban Chakraborty wrote:
Updating webpack to:
"webpack": "^5.64.4",
worked for meDisclaimer
My team was unable to utilize the --openssl-legacy-provider NODE_OPTIONS flag so we did an analysis and ended up solving the issue via another method. This solution requires that your project’s webpack be able to be updated to a newer version.
Analysis:
This issue is being caused by webpack using OpenSSL2 to generate hashes. Node no longer supports the algorithm that was utilized. In order to get around this issue we need to update the webpack dependency to be version >=5.54.0. We can view which dependencies utilize webpack by typing
npm ls webpack
in our command line with or working directory set to the projects root folder. Since webpack is typically installed as a sub-dependency with other packages we cannot directly update it through the npm cli.Solution:
Delete Node_Modules to get a clean project.
NPM >= 8.3.0 supports override statements in the package.json. In order to get around webpack causing this issue you can put the following in the bottom of your projects package.json file.
Run npm install
Test your project
Additional Points:
If you are still having issues this could be caused by another packing conflicting with the updated webpack. One such instance is older versions of postcss. Webpack requires there to be an export to the ./package.json of the node module. If we go into node_modules, and go to the ./package.json, we can add this line under exports:
“./package.json”: “./package.json”
If we do the second method then we need to make sure this step is completed each time we run npm install.
We can also just upgrade postcss via the same method as above to a newer version and in we would not have to edit it’s ./package.json for each npm install. Again this may lead to other conflicts that need to be resolved via normal troubleshooting procedure.
itt: People are rightfully confused because webpack is often bundled as part of other frameworks, which don’t always provide a way to change the command line parameters.
I still think the onus is on Webpack to release a patch to discontinue the usage of MD4 reproducibility be damned, as it was already DEPRECATED by the time affected webpack versions were released.
Setting the
hashFunction
tomd4
in our webpack config did not work in all cases with Node 18. Problem is that thehashFunction
is hard-coded in many places in webpack. Monkey-patching crypto as described here helped. See: https://github.com/cockpit-project/starter-kit/commit/3220617fec508aabbbc226a87a165c21fb72e913 and https://github.com/webpack/webpack/issues/13572Try this one @Umm-e-Habiba
set NODE_OPTIONS=--openssl-legacy-provider
Highlighting https://github.com/webpack/webpack/issues/14532#issuecomment-950161266 again since I initially missed it in the flood of comments. Webpack v5.61.0 has the fix for this bug. They’ve added a fallback for md4 hash function, which is removed in Node 18 unless you use the
--openssl-legacy-provider
flag.However, it’s recommended that you still go ahead and change your output.hashFunction in the webpack config to
xxhash64
anyway. It’s a lot faster and will become default in webpack v6.If you do use the
--openssl-legacy-provider
flag as a workaround instead, be aware that it was only added to support weak or compromised algorithms. Although webpack is not using md4 for any cryptographic purpose, so using the flag only to fix the webpack issue is fine but try to avoid this flag if you’re using node’scrypto
module anywhere in your application.I am facing this out of nowhere in webpack v4.x.x. All was working fine for the past one year. Now suddenly we encountering this. Are there any proper solution for this?
With respect, none of them worked for me. btw, I managed to fix it. For people who got the same issue building with Docker, check if you are using latest node version and fix it by using version 16.x.x or 17.x.x
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install -y nodejs
When you faced with this issue please check your webpack version firstly - run
npm ls webpack
.If you have webpack v4, you can’t use node >= 17. If you have webpack v5 - please update deps (you can run
npm update
orrm -rf package-lock.json && npm install
to force reinstall all deps).If you still have a problem please provide screenshot with a stacktrace here
The error was fixed by downgrading NVM from 17 to 16. Thank you!
JD
Thank you @dannylee8 !
FYI For others - If you’re using Angular and/or building GitHub Actions, put this in your package command (or where ever you call
ncc build
)As has been explained multiple times already, this is not only unnecessary but DANGEROUS, please do not suggest it since the issue has been successfully patched. Update your dependencies instead and make sure not to use incompatible plugins.
This is a terrible issue. I’m struggling and struggling with the build process. Calm down 👊
I am a beginner and trying to create my first react app but after running npm start it is giving this error. `` How can I solve this problem and continue creating my first app? I am a beginner so please give me the code that I need to run I am currently running it on Linux Ubuntu 20.04 of Debian distribution
`Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at module.exports (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:417:16) at handleParseError (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:471:10) at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:503:5 at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:358:12 at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:373:3 at iterateNormalLoaders (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:214:10) at iterateNormalLoaders (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:221:10) /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/react-scripts/scripts/start.js:19 throw err; ^
Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at module.exports (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:417:16) at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:452:10 at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/webpack/lib/NormalModule.js:323:13 at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:367:11 at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:233:18 at context.callback (/home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/loader-runner/lib/LoaderRunner.js:111:13) at /home/severus_snape/Documents/HTML, CSS & JAVASCRIPT/React/textutils/node_modules/babel-loader/lib/index.js:59:103 { opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ], library: ‘digital envelope routines’, reason: ‘unsupported’, code: ‘ERR_OSSL_EVP_UNSUPPORTED’ }
Node.js v17.0.1`
This worked with
angular
too! Though when executing the commands manually usingWindows PowerShell
the only way it works is by entering those two commands simultaneously dividing them with the&
sign, while inbash
you can first throw theexport
command and thenbuild
and that works. Hopefully I made it clearFYI, using this in my
package.json
I have addedexport NODE_OPTIONS=--openssl-legacy-provider &&
before my commands:Using Laravel Mix ^6 with webpack.
Run in your console
On Thu, Mar 16, 2023 at 2:50 PM XiaoLi @.***> wrote:
– [image: created with MySignature.io] https://mysignature.io/?utm_source=logo
Piyush Dolar Software Engineer Mobile: +918200646667 GitHub: https://github.com/piyushdolar https://github.com/piyushdolar Skype: piyushdolar https://mysignature.io/redirect/skype:piyushdolar?chat [image: created with MySignature.io] https://www.facebook.com/piyushdolarofficial [image: created with MySignature.io] https://twitter.com/piyush_dolar https://mysignature.io/editor/?utm_source=freepixel
Upgrading to
react-scripts
v5 when usingcreate-react-app
worked for me.I’m using Fedora 36 and node v16.15.0.
I can’t upgrade node or webpack for my project at this time. When I try to set
--openssl-legacy-provider
in NODE_OPTIONS I get:node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
This breaks vscodes
code .
from the terminal https://github.com/microsoft/vscode/issues/136599@rezab777
I changed from node:alpine to node:lts-alpine in my docker file to use node 16.x while I make the necessary changes to update the dependencies for create react app.
还有其他方法吗?我也遇到同样的问题
In which file should I put this code?
where to write this command?
Note that
export NODE_OPTIONS=--openssl-legacy-provider;
is not a good solution, since we will get following error when we roll back our Node.js to16
:Another workaround
output.hashFunction: 'sha256'
is also not a good solution since Webpack child compiler does not compact it, some plugins like html-webpack-plugin won’t work.After i run this comand in my terminal
export NODE_OPTIONS=--openssl-legacy-provider
then i try to runnpm run dev
but i got this errornode: --openssl-legacy-provider is not allowed in NODE_OPTIONS
Someone got this error too or Im doing something wrongAfter updating to the latest react-scripts I did not have to use the openssl-legacy-provided flag any longer.
What is the estimated release date for Webpack 6 which will have the new hash implementations? Seems like this issue is still very prevalent in the wild despite being marked as fixed. Ideally, workarounds should not be needed to use Webpack.
Я переустановил nodejs на 16.12.0 версию. Ошибки ушли.
Hi
Is this fix is working for windows 10 as well?
On Mon, 4 Jul 2022 at 03:37, s-usr @.***> wrote:
– Thanks & Regards
[image: image.png]
Piyush Joshi
Managing Director
Business Consultant | TechnoAce India
https://calendly.com/piyush-17/30min 9680-450-598 | 9799-992-111 @.*** www.technoace.in Jaipur, Rajasthan, India, 302020 [image: facebook] https://www.facebook.com/piyushjoshi.pj/ [image: twitter] https://twitter.com/er_piyushjoshi [image: linkedin] https://www.linkedin.com/in/piyush-joshi-🇮🇳-4409a647/ [image: instagram] https://www.instagram.com/piyushjoshi.pj/
Thanks for confirming!
Case in point that Webpack 4 needs to be retrofitted with OpenSSL 3 support, especially now that Fedora 36 has been released for a while.
I went from 17 to 16.14.2 and the error continues. I’m in a laradock
IMHO. That is CRA’s responsibility to fix. There are already workarounds to fix this issue on WebPack 4 (xxhash64) that CRA could use.
CRA v4.0.3 pins webpack to
4.44.2
exactly, so even if WebPack went to the trouble to backport work to WebPack 4 (just because CRA hasn’t updated to WebPack 5 despite having a whole year) you still wouldn’t get the fix and would still need CRA to update react-scripts in order to have the issue fixed.Nothing properly worked for me - I downgraded the node version to 16.2.0
nvm install 16.2.0
&&nvm use 16.2.0
@donnovan-lyons
React currently breaks on Node 17 (specifically, build fails). I’ve made an pull request, hope it merges soon @facebook/create-react-app#11597
Thank you!
Hooray!
I faced this issue in docker build, i have added this line in docker RUN export NODE_OPTIONS=–openssl-legacy-provider && yarn build && yarn install --production --ignore-scripts --prefer-offline
That only works if everyone working on the project uses Node 17. Node 16 or lower will throw an error on the unknown
--openssl-legacy-provider
flag.Also , before this I removed nodejs and npm and then reinstall it but not the latest then this command .
sudo npm install -g n
sudo n stable
this will give you v14 and that’s working fine!
Confirming my PR #14557 is aiming to solve your problem @zdm. Got the same error as you.
https://github.com/nodejs/node/issues/40455
Worked on angular
For all who care, I migrated from React + CRA to a new version of React + NextJS. I’ve had none of these headaches since then.
In my case, I fixed this by updating react-scripts, which in turn updates webpack.
My package.json had dependency to
"react-scripts": "^4.0.3",
and that installed webpack@4.44.2, which is causing the problem.
First, as suggested in this thread, I tried to use
but this ended up with strong warning saying that webpack version is too new and mismatch, likely causing hard-to-debug issues.
So I reverted it and instead did
npm install react-scripts@latest
as
npm ls webpack
tells that react-scripts is the one installing webpack as a downstream dependency. In my case, this updates react-scripts in package.json to"react-scripts": "^5.0.1",
and this version of react-scripts has dependency to"webpack": "^5.64.4",
. As the result, now my environment haswebpack@5.88.2
with no warnings.for VUE JS on package.json
change
"scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build" },
to"scripts": { "serve": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service serve", "build": "set NODE_OPTIONS=--openssl-legacy-provider & vue-cli-service build" },
where exactly add this?
you put this in .bashrc so that whenever you start the shell this environment variable is set. or once you open the shell at the command prompt type this…
I appear to be seeing this issue while trying to do ‘yarn start’ on a CRA app.
I’m running Rocky Linux v8.8 on a robust AWS EC2 instance. I’m running node v19.8.1.
I’ve tried adding ‘NODE_OPTIONS=–openssl-legacy-provider’ to both ‘cross-env’ and to the user environment with no apparent difference.
Here is the result while ‘NODE_OPTIONS’ is defined:
I believe that the certs are fine, I have multiple applications running and using them on this system with no issues.
I support two other systems that are running older versions of node (v14.20.0 and v14.20.1), those systems run fine.
I invite guidance about how best to proceed. A work-around is fine – this is a show-stopper.
Another popular usage:
It worked! Thank you!
I have to agree. Update the README to contain steps to solve this issue, and lock this GH issue.
It’s been discussed to death.
Please search for your particular issue in this thread before posting!
For noobs like me, I just want to clarify that you can run this directly in terminal. You won’t see any output, but it will work. (I’m on Linux, Ubuntu, Jammy)
I’m using win10 termianl git bash, just enter export NODE_OPTIONS=–openssl-legacy-provider in bash terminal , then restart you server it works. https://stackoverflow.com/questions/72866798/node-openssl-legacy-provider-is-not-allowed-in-node-options
Same here. Upgrading to node v18 is causing this break. Updating to webpack v5 is quite a lot of work and adding the --openssl-legacy-provider everywhere seems quite hacky
use nodejs v16.x.x
my pleasure
this works, thanks
guys, to solve this issue, use v16.x.x Im using v16, and its fixed you can install
nvm
to control node versionnvm install v[version here]
nvm use [version]
@ToanNguyen-SPCE run this cmd
export NODE_OPTIONS=--openssl-legacy-provider
No, It’s not working with me on Fedora but works perfectly on Windows…
I have used the following commands to switch to Node V18:
sudo dnf module enable nodejs:18
sudo dnf module switch-to nodejs:18
Then you won’t need to set the
NODE_OPTIONS
env var.Maaan…
C:\Users\Ryan\AppData\Local\Programs\Microsoft VS Code\Code.exe: --openssl-legacy-provider is not allowed in NODE_OPTIONS
What a mess. Easy to just open vs code from another terminal tab, but that’s so irritating lol. I have a tab for deployments and another for opening my coding editor strictly because of this.
@nagkumar “set NODE_OPTIONS=–openssl-legacy-provider” did not work for me, but the following did work… export NODE_OPTIONS=–openssl-legacy-provider
Is this a CRA issue or Node17 Issue, as I see the same error on the angular application when running on Node 17. The workaround that worked to me on windows machine is
set NODE_OPTIONS=--openssl-legacy-provider
I do totally agree with you. This is not responsability of webpack anymore indeed. I was just pointing out that, as today, with react-scripts 4.0.3 we still have to do the
export NODE_OPTIONS=--openssl-legacy-provider
“fix”.For those of us using CRA that still uses Webpack 4 it is still needed indeed!
Do I have to be on Nodev17?
I just ran this command on my project whilst still on V16 and I am still getting the same error message.
what is the workaround for those who are pulling the latest node image (17) and don’t want to go the
export NODE_OPTIONS=--openssl-legacy-provider
way ?v14 works 😉 since our private project was created. That’s ok for me. 😉 but thanks.
This error broke our CI/CD build setup.
we changed from
image: node:latest
to
image: node:14
Basically we rolled back from node 17 to 14 to make it work. 😦
file-loader
is deprecated for webpack v5 (https://webpack.js.org/guides/asset-modules/), anyway it should work, try to updatefile-loader
(i.e. you need update transitiveloader-utils
dep, you can runnpm update --dev
) to the latest version and runnpm ls loader-utils
@stefcameron please provide stacktrace, also run
npm ls webpack
You are right, thanks for pointing that out!
nextjs has updated webpack dependency with v12.0.2. just update.
If you use
webpack@5
, just update webpack, you don’t need workaround anymore@slorber wasm version for
v2
loader-utils https://github.com/webpack/loader-utils/releases/tag/v2.0.1, i.e.file-loader
(https://github.com/webpack-contrib/file-loader/blob/master/package.json#L44) and other loaders which use old version ofloader-utils@2
will workloader-utils v1 will not get update, time to update your code and deps
Ping there once the next version is published 🙏
@olane moving to asset modules wasn’t so easy for me (https://github.com/facebook/docusaurus/pull/4708), will invest more time on this later.
And there’s something else using the missing hash algo in Webpack (can’t find exactly what but looks related to something using DefinePlugin), so fixing file-loader won’t solve it for me anyway.
@slorber It is breaking change, and we will need do major release of
url-loader
, and this will force other breaking changes, I will do compatibility patch release for v2 when we finish it here, but with limitations for very old Node.js versions (we can’t fix it for v4, v6, v8)We don’t have a hard requirement, but if possible I’d like to make our local build and run process as foolproof as possible - if I can not worry if a developer has installed latest or LTS Node when setting up their machine then I’m going to have less questions to answer 😃
The
output.hashFunction
fix doesn’t work for me - more specifically, it solves one error but there seem to be more instances of the same error with file-loader. I’m looking at replacing that since it’s deprecated but the env var fix does seem to work - although it requirescross-env
to make it work across platforms.Serious question - do people have a hard requirement to use Node 17 or why is there so much panic? What feature of Node 17 (which came out just recently) is so crucial that you cannot run Node 16 (current LTS) in your CI systems or locally?
Please, solution is above, just use it
That’s just because
n
aliasesstable
tolts
. Node has no “stable”, they have “current” and “lts” (which can be active or maintenance). Both of which are stable.Edit: The
current
Node.js is v16 and v17. The maintenancelts
is v14. Tomorrow v16 is going to stop beingcurrent
and become the activelts
.@csvan
core-js-builder@3
should support NodeJS 8 for the compatibility reason and I’m not sure thatcore-js@4
ecosystem will be released this year. Sincecore-js-builder@3
is the actual version, it should support NodeJS 17 too. Anyway, changingmd4
to something else is not a breaking change in this case.@alexander-akait Repo ot reproduce warnings. when
xxhash
is used. https://github.com/zdm/webpack-issue-14532I recommend install nvm and install v14.15.0 (using nvm you can change node version and solve this problems)
@onurusluca Do you mean
nodejs 17: digital envelope routines::unsupported
orSkipped not serializable cache item
? If first just useNODE_OPTIONS=--openssl-legacy-provider
, anyway we have idea how to fix it without breaking change for v5, we will reimplement md4 using wasm version, anyway I strong recommend to switch onxxhash64
Yes, will do
On 23.10.2021 16:50, Alexander Akait wrote:
@xdadev37
env
prefix (see example above) should work cross platform.