"npm run" fails with ERR_OSSL_EVP_UNSUPPORTED - node.js

I have an existing project which I lately installed on a new equipment.
It is a Laravel + vue project.
When I run npm run watch I get the following error:
> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
10% building 1/1 modules 0 active
webpack is watching the files…
10% building 1/3 modules 2 active ...er/index.js??ref--5-4!/var/www/node_modules/sass-loader/lib/loader.js??ref--5-5!/var/www/resources/sass/app.scssError: 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 (/var/www/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/var/www/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/var/www/node_modules/webpack/lib/NormalModule.js:471:10)
at /var/www/node_modules/webpack/lib/NormalModule.js:503:5
at /var/www/node_modules/webpack/lib/NormalModule.js:358:12
at /var/www/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /var/www/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at runSyncOrAsync (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
at iterateNormalLoaders (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
at /var/www/node_modules/loader-runner/lib/LoaderRunner.js:186:6
at runSyncOrAsync (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
at /var/www/node_modules/loader-runner/lib/LoaderRunner.js:178:3
at loadLoader (/var/www/node_modules/loader-runner/lib/loadLoader.js:47:3)
at iteratePitchingLoaders (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
at iteratePitchingLoaders (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:165:10)
at /var/www/node_modules/loader-runner/lib/LoaderRunner.js:188:6
at runSyncOrAsync (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:124:12)
at /var/www/node_modules/loader-runner/lib/LoaderRunner.js:178:3
at loadLoader (/var/www/node_modules/loader-runner/lib/loadLoader.js:47:3)
at iteratePitchingLoaders (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
at runLoaders (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:365:2)
at NormalModule.doBuild (/var/www/node_modules/webpack/lib/NormalModule.js:295:3)
at NormalModule.build (/var/www/node_modules/webpack/lib/NormalModule.js:446:15)
at Compilation.buildModule (/var/www/node_modules/webpack/lib/Compilation.js:739:10)
at /var/www/node_modules/webpack/lib/Compilation.js:981:14
at /var/www/node_modules/webpack/lib/NormalModuleFactory.js:409:6
at /var/www/node_modules/webpack/lib/NormalModuleFactory.js:155:13
at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (/var/www/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at /var/www/node_modules/webpack/lib/NormalModuleFactory.js:138:29
at /var/www/node_modules/webpack/lib/NormalModuleFactory.js:346:9
at processTicksAndRejections (node:internal/process/task_queues:78:11)
node:internal/crypto/hash:67
this[kHandle] = new _Hash(algorithm, xofLen);
^
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 (/var/www/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/var/www/node_modules/webpack/lib/NormalModule.js:417:16)
at /var/www/node_modules/webpack/lib/NormalModule.js:452:10
at /var/www/node_modules/webpack/lib/NormalModule.js:323:13
at /var/www/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /var/www/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/var/www/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /var/www/node_modules/babel-loader/lib/index.js:55:103 {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
I am using Node.js v17.3.0, npm version 8.3.0, and webpack 4.41.4.

Node.js version 17 has switched to using OpenSSL 3.0. They advise:
While OpenSSL 3.0 APIs should be mostly compatible with those provided by OpenSSL 1.1.1, we do anticipate some ecosystem impact due to tightened restrictions on the allowed algorithms and key sizes.
If you hit an ERR_OSSL_EVP_UNSUPPORTED error in your application with Node.js 17, it’s likely that your application or a module you’re using is attempting to use an algorithm or key size which is no longer allowed by default with OpenSSL 3.0. A command-line option, --openssl-legacy-provider, has been added to revert to the legacy provider as a temporary workaround for these tightened restrictions.
This has been resolved in Webpack versions 5 and 6, but there are no plans to backport this fix to version 4.
To pass the --openssl-legacy-provider flag to Node, you can prefix your command with the environment variable assignment:
NODE_OPTIONS=--openssl-legacy-provider npm run watch

What worked for me (on Ubuntu 22.04) was adding this to the package.json file:
{
"scripts": {
"start": "react-scripts --openssl-legacy-provider start"
}
}
I found the complete answer in this article by Borislav Hadzhiev: Fix - error:0308010C:digital envelope routines::unsupported

Related

Error 'digital envelope' when starting 1.0.0-rc2 AGE Viewer

One of my friend facing this error while installing Age-Viewer.
Screenshots
Node.js v18.12.1
Starting the development server...
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (D:\workspace\tools\age-viewer\frontend\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\workspace\tools\age-viewer\frontend\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\workspace\tools\age-viewer\frontend\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\workspace\tools\age-viewer\frontend\node_modules\webpack\lib\NormalModule.js:503:5
at D:\workspace\tools\age-viewer\frontend\node_modules\webpack\lib\NormalModule.js:358:12
at D:\workspace\tools\age-viewer\frontend\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\workspace\tools\age-viewer\frontend\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\workspace\tools\age-viewer\frontend\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
D:\workspace\tools\age-viewer\frontend\node_modules\react-scripts\scripts\start.js:19
throw err;
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (D:\workspace\tools\age-viewer\frontend\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\workspace\tools\age-viewer\frontend\node_modules\webpack\lib\NormalModule.js:417:16)
at D:\workspace\tools\age-viewer\frontend\node_modules\webpack\lib\NormalModule.js:452:10
at D:\workspace\tools\age-viewer\frontend\node_modules\webpack\lib\NormalModule.js:323:13
at D:\workspace\tools\age-viewer\frontend\node_modules\loader-runner\lib\LoaderRunner.js:367:11
at D:\workspace\tools\age-viewer\frontend\node_modules\loader-runner\lib\LoaderRunner.js:233:18
at context.callback (D:\workspace\tools\age-viewer\frontend\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
at D:\workspace\tools\age-viewer\frontend\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 v18.12.1
ERROR: "front" exited with 1.
Desktop (please complete the following information):
OS: Windows
Browser: Microsoft Edge
Version: 108.0.1462.54
You can get Age-Viewer from: https://github.com/apache/age-viewer
Cannot start AGE Viewer 1.0.0-rc2, by following README.md.
According to Error message "error:0308010C:digital envelope routines::unsupported"
envelope-routinesunsupported , I added --openssl-legacy-provider in frontend/package.json script start, but didn't work.
To Reproduce
Steps to reproduce the behavior:
npm run setup
npm run start
Expected behavior
A clear and concise description of what you expected to happen.
I use Node.js v18.12.1
The given solutions are not specifically for Age-Viewer .
I found the solution as Age-Viewer is not supporting node greater then 14 therefore getting this error. If I installed the node js 14.16.0 it will work properly.

how do i open the developer menu of react-native

I am trying to open it using
npm run web
but it doesn't work instead it gives this error
some-random-app#1.0.0 web
> expo start --web
Starting project at C:\Users\surya\OneDrive\Desktop\react-native\some-random-app
Starting Metro Bundler
Starting Webpack on port 19006 in development mode.
‼ 「wds」: transportMode is an experimental option, meaning its usage could potentially change without warning
node:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
^
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 (C:\Users\surya\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (C:\Users\surya\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (C:\Users\surya\node_modules\webpack\lib\NormalModule.js:471:10)
at C:\Users\surya\node_modules\webpack\lib\NormalModule.js:503:5
at C:\Users\surya\node_modules\webpack\lib\NormalModule.js:358:12
at C:\Users\surya\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (C:\Users\surya\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at Array.<anonymous> (C:\Users\surya\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (C:\Users\surya\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at C:\Users\surya\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
at C:\Users\surya\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v19.3.0
how do i overcome this
i just want to open the developer menu of react

Whole MERN stack application will not start after changing MaterialUI icons

After restoring to a previous version on Git my application is still failing to load. This has never happened to me, no matter what I have been able to use Git and restore to my previous versions as I like to commit often. I don't understand how I can get this error even after that. I am creating a MERN stack application, here is my error. This happened after I installed some delete icons from MaterialUI.
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/brandon/the_odin_project/bandmate/client/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/home/brandon/the_odin_project/bandmate/client/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/home/brandon/the_odin_project/bandmate/client/node_modules/webpack/lib/NormalModule.js:471:10)
at /home/brandon/the_odin_project/bandmate/client/node_modules/webpack/lib/NormalModule.js:503:5
at /home/brandon/the_odin_project/bandmate/client/node_modules/webpack/lib/NormalModule.js:358:12
at /home/brandon/the_odin_project/bandmate/client/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/home/brandon/the_odin_project/bandmate/client/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/home/brandon/the_odin_project/bandmate/client/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/home/brandon/the_odin_project/bandmate/client/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/brandon/the_odin_project/bandmate/client/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/home/brandon/the_odin_project/bandmate/client/node_modules/webpack/lib/NormalModule.js:417:16)
at /home/brandon/the_odin_project/bandmate/client/node_modules/webpack/lib/NormalModule.js:452:10
at /home/brandon/the_odin_project/bandmate/client/node_modules/webpack/lib/NormalModule.js:323:13
at /home/brandon/the_odin_project/bandmate/client/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/brandon/the_odin_project/bandmate/client/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/brandon/the_odin_project/bandmate/client/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /home/brandon/the_odin_project/bandmate/client/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'
}
I have tried replacing "start": "react-scripts start"
with
"start": "react-scripts --openssl-legacy-provider start"
and replaced
"build": "react-scripts build"
with
"build": "react-scripts --openssl-legacy-provider build"
In my package.json as seen on here, but it does nothing. not even an error, it just forever loads the page. This is the only solution I have seen on anywhere for this error.
This is a problem with Node.js dropping compatibility with OpenSSL 1.1.1.
Run with the openssl-legacy-provider option, for example:
NODE_OPTIONS=--openssl-legacy-provider npm run watch
see https://github.com/nodejs/node/issues/40455

ERR_OSSL_EVP_UNSUPPORTED while attempting npx idk deploy of React app

I am posting this to hopefully spare someone else some of the bang-head-on-desk moments I encountered.
I received the following error when attempting to run npx cdk deploy today:
[my user]#MacBook-Pro: ~/[Path-to-my-project] $ npx cdk deploy [12:19:19] Bundling asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage... yarn run v1.22.15 warning Skipping preferred cache folder "/.cache/yarn" because it is not writable. warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-501". $ react-scripts build warning Cannot find a suitable global folder. Tried these: "/usr/local, /.yarn" Creating an optimized production build... 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 (/asset-input/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/asset-input/node_modules/webpack/lib/NormalModule.js:417:16) at handleParseError (/asset-input/node_modules/webpack/lib/NormalModule.js:471:10) at /asset-input/node_modules/webpack/lib/NormalModule.js:503:5 at /asset-input/node_modules/webpack/lib/NormalModule.js:358:12 at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:373:3 at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:214:10) at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:221:10) at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:236:3 at runSyncOrAsync (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:130:11) at iterateNormalLoaders (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:232:2) at Array.<anonymous> (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:205:4) at Storage.finished (/asset-input/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16) at /asset-input/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9 /asset-input/node_modules/react-scripts/scripts/build.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 (/asset-input/node_modules/webpack/lib/util/createHash.js:135:53) at NormalModule._initBuildHash (/asset-input/node_modules/webpack/lib/NormalModule.js:417:16) at /asset-input/node_modules/webpack/lib/NormalModule.js:452:10 at /asset-input/node_modules/webpack/lib/NormalModule.js:323:13 at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:367:11 at /asset-input/node_modules/loader-runner/lib/LoaderRunner.js:233:18 at context.callback (/asset-input/node_modules/loader-runner/lib/LoaderRunner.js:111:13) at /asset-input/node_modules/react-scripts/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 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Failed to bundle asset ApplicationStack/WebApp/WebAppDeploy/WebAppDeploy/Asset1/Stage, bundle output is located at /Users/[my user]/PycharmProjects/ps-serverless-app/infrastructure/cdk.out/asset.8c7ae86f7dabf723a79310f22f328c471bdaec37da5325cd834784dc03a40eff-error: Error: docker exited with status 1 Subprocess exited with error 1 FAIL
This error is a bit confusing as my version of node is v16.13.0
It appears that simply upgrading npm to v8.1.3 is enough to trigger this issue.
It seems to be related to attempted use of MD4 algorithm.
I found an article here that has a working solution for my specific situation.
The answer by Chesiremoe worked perfectly for me.
Unfortutely I do not have enough "street cred" on here to comment on that post and thank this user specifically but this answer was much appreciated!!
Adding this code to node_modules\react-scripts\config\webpack.config.js
resolved this issue:
const crypto = require("crypto"); const crypto_orig_createHash = crypto.createHash; crypto.createHash = algorithm => crypto_orig_createHash(algorithm == "md4" ? "sha256" : algorithm);

plz help for aws ec2 react+node build error

I worked react webapp in two different folders 'client'(frontend) and 'server'(backend)
on ec2 sever i cloned my project from git and start npm install in client folder.
then enter npm run build.
and finally i faced with error below.
i have no idea what is wrong with this error...
Creating an optimized production build...
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/ec2-user/seezzle/client/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/home/ec2-user/seezzle/client/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/home/ec2-user/seezzle/client/node_modules/webpack/lib/NormalModule.js:471:10)
at /home/ec2-user/seezzle/client/node_modules/webpack/lib/NormalModule.js:503:5
at /home/ec2-user/seezzle/client/node_modules/webpack/lib/NormalModule.js:358:12
at /home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at iterateNormalLoaders (/home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
at /home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:236:3
at runSyncOrAsync (/home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
at iterateNormalLoaders (/home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
at Array.<anonymous> (/home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/home/ec2-user/seezzle/client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /home/ec2-user/seezzle/client/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
/home/ec2-user/seezzle/client/node_modules/react-scripts/scripts/build.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/ec2-user/seezzle/client/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/home/ec2-user/seezzle/client/node_modules/webpack/lib/NormalModule.js:417:16)
at /home/ec2-user/seezzle/client/node_modules/webpack/lib/NormalModule.js:452:10
at /home/ec2-user/seezzle/client/node_modules/webpack/lib/NormalModule.js:323:13
at /home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/ec2-user/seezzle/client/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /home/ec2-user/seezzle/client/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'
}
Verify your Node version, is a LTS version 14.x.x
node --version
try to uninstall the current and install LTS https://nodejs.org/en/download/
try this command
export NODE_OPTIONS=--openssl-legacy-provider
I fixed it downgrading my node version to LTS. I was facing this issue in node.17X. When I downgraded to 16.12.0 LTS my problem is solved.

Resources