Closed creeper-0910 closed 1 year ago
Happens for me too!
Default Vue 3 Cli project Ubuntu 22.10
This is not related to this package. A quick search on the world wide web would have given you the solution: https://stackoverflow.com/questions/69692842/error-message-error0308010cdigital-envelope-routinesunsupported
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.
tried --openssl-legacy-provider
but it did not work.....
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.....
I have the same problem...
I tried "set NODE_OPTIONS=--openssl-legacy-provider", "export NODE_OPTIONS=--openssl-legacy-provider", "cross-env NODE_OPTIONS=--openssl-legacy-provider" but I get this message : "electron: --openssl-legacy-provider is not allowed in NODE_OPTIONS"
This problem appeared after the update from nodejs 16.17.0 to 18.12.1 (LTS). (I use electron 21.0.1).
I noticed that by modifying the algorithm manually in createHash.js (in vue-cli-plugin-electron-builder/node_modules/webpack/lib/util), the problem disappears, but I haven't found a permanent solution 😕
I already tried this (in vue.config.js) :
configureWebpack: { output: { hashFunction: "sha256" }, },
The problem is not related to this project, but one of the many used (dev)dependencies. It is a common problem. Stackoverflow have much more information about it than I can provide. Setting the env variable worked in my projects. There is nothing I can do for you.
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);
};
}
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); }; }
Thank you! I will try that.
Update the "vue-cli-plugin-electron-builder" version to "v3.0.0-alpha.4", because the "~2.x" version dependencie on webpack 4, change to webpack 5 to accommodate the latest Node.js LTS version and maintain SSL security.
See running:
#> npm ls webpack
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: