question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When I run "yarn run electron:serve" on node v18.12.1, I get "error:0308010C:digital envelope routines::unsupported".

See original GitHub issue

When I run “yarn run electron:serve” on node v18.12.1, I get “error:0308010C:digital envelope routines::unsupported”. I am using Windows and tried “–openssl-legacy-provider” but it did not work. The detailed logs are as follows:

yarn run electron:serve
yarn run v1.22.15
warning ..\..\package.json: No license field
$ vue-cli-service electron:serve --openssl-legacy-provider
 INFO  Starting development server...


 DONE  Compiled successfully in 3626ms                                                                                                                                                                                                5:02:32

  App running at:
  - Local:   http://localhost:8080/
  - Network: http://192.168.0.x:8080/

  Note that the development build is not optimized.
  To create a production build, run yarn build.

-  Bundling main process...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:133:10)
    at module.exports (C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:471:10)
    at C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:503:5
    at C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\webpack\lib\NormalModule.js:358:12
    at C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at C:\Users\user\Desktop\vue-electron\node_modules\vue-cli-plugin-electron-builder\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at C:\Users\user\Desktop\vue-electron\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 v18.12.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

2reactions
lulucraftcommented, Nov 16, 2022

Indeed, after several searches, I found a solution in stackoverflow ! https://stackoverflow.com/a/72219174

Just add this to the top of vue.config.js :

const crypto = require('crypto');

/**
 * md4 algorithm is not available anymore in NodeJS 17+ (because of lib SSL 3).
 * In that case, silently replace md4 by md5 algorithm.
 */
try {
  crypto.createHash('md4');
} catch (e) {
  console.warn('Crypto "md4" is not supported anymore by this Node version');
  const origCreateHash = crypto.createHash;
  crypto.createHash = (alg, opts) => {
    return origCreateHash(alg === 'md4' ? 'md5' : alg, opts);
  };
}
1reaction
MatthijsBurghcommented, Nov 15, 2022

No it doesn’t, as it not an argument to vue-cli-service

Either use export NODE_OPTIONS=--openssl-legacy-provider or cross-env NODE_OPTIONS=--openssl-legacy-provider in your scripts…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error message "error:0308010C:digital envelope routines ...
This fix was a breaking change that corresponded with similar breaking changes in the SSL packages in NPM. When you attempt to use...
Read more >
error:0308010c:digital envelope routines::unsupported [Node ...
If you work with Node.js and command line interface solutions like ... I'm currently getting it too: The React app indeed failed to...
Read more >
Error:0308010C:digital envelope routines::unsupported #11708
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...
Read more >
How to Fix the Error Error:error:0308010C:digital envelope ...
Pass the --openssl-legacy-provider flag to Webpack or the Webpack-based CLI tool. Set the NODE_OPTIONS environment variable to --openssl-legacy ...
Read more >
error:0308010C:digital envelope routines::unsupported [Fixed]
The error:0308010C:digital envelope routines::unsupported occurs because Node.js v17 and later use OpenSSL v3.0 which has had breaking changes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found