Skip to content
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

Error:0308010C:digital envelope routines::unsupported #11708

Open
Manuel-Suarez-Abascal opened this issue Dec 3, 2021 · 35 comments
Open

Error:0308010C:digital envelope routines::unsupported #11708

Manuel-Suarez-Abascal opened this issue Dec 3, 2021 · 35 comments

Comments

@Manuel-Suarez-Abascal
Copy link

Describe the bug

I installed the latest Node version, currently, it's 17.2.0. When I try to start the project in development mode with the command npm run start, it throws an error & it's unable to start the project for development.

Pre-requisites:

Steps to reproduce:

  • run the command npx create-react-app hello-world
  • navigate to the project's root & run the command: npm run start

Expected results

It was expected to compile in dev mode & launch React's app in the browser like in the screenshot below: ( which it's using Node's version 16.13.1)

expected-result

Actual results

It doesn't compile & it throws the following error instead:

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 (C:\Users\manue\Desktop\projects\hello-world\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\Users\manue\Desktop\projects\hello-world\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (C:\Users\manue\Desktop\projects\hello-world\node_modules\webpack\lib\NormalModule.js:471:10)
    at C:\Users\manue\Desktop\projects\hello-world\node_modules\webpack\lib\NormalModule.js:503:5
    at C:\Users\manue\Desktop\projects\hello-world\node_modules\webpack\lib\NormalModule.js:358:12
    at iterateNormalLoaders (C:\Users\manue\Desktop\projects\hello-world\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at iterateNormalLoaders (C:\Users\manue\Desktop\projects\hello-world\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
C:\Users\manue\Desktop\projects\hello-world\node_modules\react-scripts\scripts\start.js:19
  throw err;
  ^

Error: error:0308010C:digital envelope routines::unsupported
    at Object.createHash (node:crypto:130:10)
    at module.exports (C:\Users\manue\Desktop\projects\hello-world\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\Users\manue\Desktop\projects\hello-world\node_modules\webpack\lib\NormalModule.js:417:16)
    at C:\Users\manue\Desktop\projects\hello-world\node_modules\webpack\lib\NormalModule.js:452:10
    at C:\Users\manue\Desktop\projects\hello-world\node_modules\webpack\lib\NormalModule.js:323:13
    at C:\Users\manue\Desktop\projects\hello-world\node_modules\loader-runner\lib\LoaderRunner.js:367:11
    at C:\Users\manue\Desktop\projects\hello-world\node_modules\loader-runner\lib\LoaderRunner.js:233:18
    at context.callback (C:\Users\manue\Desktop\projects\hello-world\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
    at C:\Users\manue\Desktop\projects\hello-world\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'
}

This is a screenshot of the issue:

actual-result

Workaround

  • uninstall Node's version 17.2.0
  • install Node's version 16.13.1
  • run npm run start

The app should compile now.

@Kurzdor
Copy link

Kurzdor commented Dec 3, 2021

I am having the same issue with Windows 10 21H1 (19048.1348), WSL 2 (Ubuntu 20.04.3 LTS) and Node 17.0.1.

We have two three workarounds:

  1. Use --openssl-legacy-provider argument in start script in package.json, but it is not recommended!
  2. Downgrade Node to latest v16 like was mentioned in issue
  3. Wait for CRA v5 or try CRA@next tag

@nicholasrobertson
Copy link

nicholasrobertson commented Dec 5, 2021

While you wait for a new CRA version, you can run Node version 16 without uninstalling version 17 using nvm

nvm install 16.13.0
nvm run 16.13.0

Have a look at creating a .nvmrc file in your projects root.
https://github.com/nvm-sh/nvm#nvmrc

I assume the issue is CRA using webpack-v4 and is resolved upgrading to v5 ( I haven’t actually validated this ) (#14532)
#11563
#11562

@stale
Copy link

stale bot commented Jan 8, 2022

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Jan 8, 2022
@aaliya-shaikh
Copy link

Came across the same bug.
OS: Ubuntu 20.0.4
node: v17.3.1
npm: 8.3.0

@cryptiswap-admin
Copy link

I'm also experiencing this problem with the latest version of nodejs and NPM:
node: v17.3.1
npm: 8.3.0

@TadRodgers
Copy link

TadRodgers commented Jan 13, 2022

I'm having the same issue within CentOs Stream Version 9:
node: v17.3.0
npm: 8.3.0

My work around was to down-grade Node:

$ npm install -g n
$ n 16.13.1

$ nvm install 16.13.1
$ nvm use 16.13.1

Then I was able to continue with the build process.

@jmgtan
Copy link

jmgtan commented Jan 17, 2022

Running react build also triggers this problem. The only workaround right now is to use Node 16.x

@Emekaony
Copy link

Emekaony commented Jan 21, 2022

Just as @TadRodgers and @Manuel-Suarez-Abascal mentioned: downgrading node is probably the best way to go. Did that and everything is working just fine now.

I used:

npm uninstall node to uninstall node
npm install [email protected] to install node at that specific version
then source ./bash_profile to do some shell magic in order to register my current session with the current installation.

@rhythmshandlya
Copy link

While you wait for a new CRA version, you can run Node version 16 without uninstalling version 17 using nvm

nvm install 16.13.0 nvm run 16.13.0

Have a look at creating a .nvmrc file in your projects root. https://github.com/nvm-sh/nvm#nvmrc

I assume the issue is CRA using webpack-v4 and is resolved upgrading to v5 ( I haven’t actually validated this ) (#14532) #11563 #11562

workaround is not what I am looking for rn :(

@nicholasrobertson
Copy link

nicholasrobertson commented Jan 29, 2022

While you wait for a new CRA version, you can run Node version 16 without uninstalling version 17 using nvm
nvm install 16.13.0 nvm run 16.13.0
Have a look at creating a .nvmrc file in your projects root. https://github.com/nvm-sh/nvm#nvmrc
I assume the issue is CRA using webpack-v4 and is resolved upgrading to v5 ( I haven’t actually validated this ) (#14532) #11563 #11562

workaround is not what I am looking for rn :(

Haha, @rhythmshandlya You can try the Alpha release that supports webpack v5 and see if you get the same error. I'm sure the devs would appreciate the testing feedback.

npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app

#11278
#9994

@maulik-modi
Copy link

maulik-modi commented Feb 14, 2022

I faced this error on Windows 10 as well as Ubuntu due to Node version 17.
Yes, I simply switched to nvm 16.13.0 and it started running. Thanks @nicholasrobertson , it worked like a charm!

@RodrigoTomeES
Copy link

Hi,

I am using CRA 5 and I am having the same error, Do you know when it will be fixed?

Thanks!

@maulik-modi
Copy link

@RodrigoTomeES , is there any reason to use Node V17 over Node 16 LTS?

@RodrigoTomeES
Copy link

@maulik-modi Hi, I am using this new feature from Node 17.

import config from './sample.config.json' assert { type: 'json};

@ghost
Copy link

ghost commented Mar 10, 2022

I got this error while importing svg (import logo from './logo.svg';).
running npm update loader-utils solved it.

@skulas
Copy link

skulas commented Mar 29, 2022

In our case, we didn't downgrade node and kept v17.x but we added this to the package.json build command:
--openssl-legacy-provider

@ianw
Copy link

ianw commented Aug 18, 2022

Just for anyone finding this; it's not exclusively a v17.x issue, but depends on the system openssl version. For example I hit this on Fedora 36 with the packaged version of nodejs (16.14.0) -- this doesn't have the --openssl-legacy-provider tag. I ended up installing an alternative version with nvm --install lts

@Tonya713MS
Copy link

cd into your newly created app directory run the following
Run:
npm install -g npm-check-updates

Then:
ncu -u

Then:
npm install

Then:
npm start

@filssavi
Copy link

I am encountering this bug on a clean Ubuntu 22.04 machine with the lastest CRA (5.0.1).
Unfortunately I have neither the time, nor the capabilities to investigate this bug, any further.

Are there any news on when it should be fixed?

@SOUMOJIT-CHAKRABORTY
Copy link

nvm install 16.13.1

Thanks, it helped me to resolve my issue😊

@JaffParker
Copy link

JaffParker commented Oct 26, 2022

Lol installing 16.13.1 and then reinstalling node_modules results in:

Internal Error: Unable to deserialize cloned data due to invalid or unsupported version.
    at Object.deserialize (node:v8:344:7)
    at Ke.restoreInstallState (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:447:965)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async LC.execute (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:561:1879)
    at async LC.validateAndExecute (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:337:620)
    at async oo.run (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:351:1846)
    at async oo.runExit (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:351:2013)
    at async i (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:448:12377)
    at async r (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:448:10617)

On the other hand, adding the --openssl-legacy-provider flag adds more errors. Now I've reinstalled my latest node so at least I'm done to one error and broken hot reloading, and instead I'm up to 52 errors, broken everything and can't work.

@whyprax
Copy link

whyprax commented Nov 4, 2022

Lol installing 16.13.1 and then reinstalling node_modules results in:

Internal Error: Unable to deserialize cloned data due to invalid or unsupported version.
    at Object.deserialize (node:v8:344:7)
    at Ke.restoreInstallState (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:447:965)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async LC.execute (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:561:1879)
    at async LC.validateAndExecute (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:337:620)
    at async oo.run (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:351:1846)
    at async oo.runExit (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:351:2013)
    at async i (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:448:12377)
    at async r (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:448:10617)

On the other hand, adding the --openssl-legacy-provider flag adds more errors. Now I've reinstalled my latest node so at least I'm done to one error and broken hot reloading, and instead I'm up to 52 errors, broken everything and can't work.

Adding the --openssl-legacy-provider worked for me.

Steps to resolve the issue using --openssl-legacy-provider :

  • update your start script in package.json to use react-scripts --openssl-legacy-provider start

It should look like this :
"start": "react-scripts --openssl-legacy-provider start",

@kalpeshsuthar12
Copy link

first, check your local System version for npm ( npm -v ) and node ( node -v ) and add in your package.json
"engines": {
"node": "YOUR_SYSTEM_NODE_VERISON",
"npm": "YOUR_SYSTEM_NPM_VERISON"
}

@KonstantinLukaschenko
Copy link

KonstantinLukaschenko commented Nov 6, 2022

Updating loader-utils from 2.0.0 to 2.0.1 or above in yarn.lock worked for me.

loader-utils added support for Node.js 17 in webpack/loader-utils#193

@d3x0r
Copy link

d3x0r commented Nov 13, 2022

I find this works to just use node 18....
set NODE_OPTIONS=--openssl-legacy-provider

@samjundi
Copy link

**Tonya713MS ** commented Oct 5, 2022

it works with react projects. many thanks

@na-zi-ya
Copy link

na-zi-ya commented Jan 9, 2023

I am struggling with this too....
- node v19.3.0
- npm v9.2.0
- yarn v1.22.17

I tried to run my @react app and got Error:0308010C:digital envelope routines::unsupported.
I've spent a few hours searching around and can't find a solid answer to the problem.
Is there any other solution without downgrading node version...?
Thanks..!!

@julianD77
Copy link

julianD77 commented Jan 10, 2023

Have you tried setting this ENV VAR?

NODE_OPTIONS=--openssl-legacy-provider

I haven't tried it against node v19 yet but it works for us on node 18.4.0 and on macos

Note however that for us this needs to be just a temporary solution until the issue is resolved in the underlying dependency since its likely we want to be able to use to non-legacy openssl provider in the long term

@moedayraki
Copy link

@julianD77 I've tried that and it's still the same problem for me.
image

@mrfourking
Copy link

I got this error while importing svg (import logo from './logo.svg';). running npm update loader-utils solved it.

It`s worked for me

@smanrog-tekinforkom
Copy link

smanrog-tekinforkom commented Mar 7, 2023

when i start in termux app(android) it goes error like this too

Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:71:19) at Object.createHash (node:crypto:140:10) at module.exports (/data/data/com.termux/files/home/react/web-chat-pingo/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/data/data/com.termux/files/home/react/web-chat-pingo/node_modules/webpack/lib/NormalModule.js:417:16) at /data/data/com.termux/files/home/react/web-chat-pingo/node_modules/webpack/lib/NormalModule.js:452:10 at /data/data/com.termux/files/home/react/web-chat-pingo/node_modules/webpack/lib/NormalModule.js:323:13 at /data/data/com.termux/files/home/react/web-chat-pingo/node_modules/loader-runner/lib/LoaderRunner.js:367:11 at /data/data/com.termux/files/home/react/web-chat-pingo/node_modules/loader-runner/lib/LoaderRunner.js:233:18 at context.callback (/data/data/com.termux/files/home/react/web-chat-pingo/node_modules/loader-runner/lib/LoaderRunner.js:111:13) at /data/data/com.termux/files/home/react/web-chat-pingo/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' }

maybe it just unsupported on babel loader CMIIW

@Desarrollos-Web-Urquiza

Lol installing 16.13.1 and then reinstalling node_modules results in:

Internal Error: Unable to deserialize cloned data due to invalid or unsupported version.
    at Object.deserialize (node:v8:344:7)
    at Ke.restoreInstallState (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:447:965)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async LC.execute (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:561:1879)
    at async LC.validateAndExecute (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:337:620)
    at async oo.run (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:351:1846)
    at async oo.runExit (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:351:2013)
    at async i (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:448:12377)
    at async r (/home/andrey/Code/cashflowio/.yarn/releases/yarn-3.1.1.cjs:448:10617)

On the other hand, adding the --openssl-legacy-provider flag adds more errors. Now I've reinstalled my latest node so at least I'm done to one error and broken hot reloading, and instead I'm up to 52 errors, broken everything and can't work.

Adding the --openssl-legacy-provider worked for me.

Steps to resolve the issue using --openssl-legacy-provider :

  • update your start script in package.json to use react-scripts --openssl-legacy-provider start

It should look like this : "start": "react-scripts --openssl-legacy-provider start",

This works for me!

@rhiskey
Copy link

rhiskey commented May 3, 2023

cd into your newly created app directory run the following Run: npm install -g npm-check-updates

Then: ncu -u

Then: npm install

Then: npm start

This one works perfectly well!

TobiObeck added a commit to TobiObeck/escapeling-lobby that referenced this issue Jul 28, 2023
I installed `npm install [email protected] --save-exact`. I think subsequent `node install` should use exact node version because the former added `node: 14.17.6,` as a dependency in `package.json`
For a more recent node version two things need to happen:
- `node-sass` complained, so needs to be replaced with `sass` (e.g.^1.64.1) which is implemented with dart (pure-JavaScript package built from the Dart Sass)
- node 17 needs openSSL dependency for crypto module (is used by webpack server or sth like that). I could consider moving to vite instead of webpack
facebook/create-react-app#11708
https://stackoverflow.com/questions/73144960/error-error0308010cdigital-envelope-routinesunsupported-at-new-hash-nodei
@baptooo
Copy link

baptooo commented Dec 7, 2023

Hello, if this can help future people encountering this issue.
The problem seems to be at loader-utils library level and this was patched on version 2.0.1

Here is the fix:
webpack/loader-utils#193

On my project I specified a resolution for this dependency and it's working perfectly without the need for specifying Node's NODE_OPTIONS=--openssl-legacy-provider option.

Extract from package.json:

{
  "name": "My project",
  "version": "1.0.0",
  "dependencies": {
    "react-scripts": "^5.0.1",
    ...
  },
+  "resolutions": {
+    "loader-utils": "^2.0.1"
+  }
}

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

No branches or pull requests