Error message:
When the front-end project is started (npm run dev) and packaged (npm run build:prod), the following error is reported:
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
....
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'
}
Cause of problem:
The reason for this is that nodeJs V17 released OpenSSL3.0 with stricter restrictions on the algorithm and secret key size, which did not affect versions before nodeJs v17, but this error will occur in V17 and later versions.
Solution (windows only):
Add SET NODE_OPTIONS=--openssl-legacy-provider in the scripts of the package.json
Before:
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build"
},
Added:
"scripts": {
"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build"
},
Note: If the node version in the team is not the same, do not submit the package.json.
My v18.8.0 does not add this directive, my colleague is v14.17.3, adding this directive will report an error
Read More:
- [Solved] Error: error:0308010C:digital envelope routines::unsupported
- [Solved] Error: error:0308010C:digital envelope routines::unsupported
- [Solved] Vue Error: error:0308010C:digital envelope routines::unsupported
- [Solved] NUXT.JS. npm run dev Error: Error: error:0308010C:digital envelope routines::unsupported
- [Solved] NPM Start Project Error: ‘Error: error:0308010C:digital envelope routines::unsupported’
- [Solved] Syntax Error: Error: Node Sass does not yet support your current environment: OS X Unsupported archi
- How to Solve Vue project Startup Error (Node Upgrade issue)
- [Solved] error C:\Users\HP\Desktop\VueProject\vue_cli\node_modules\node-sass: Command failed.Exit code: 1
- [Solved] Msbuild: error msb3428: the group cannot use the visual c + + function “vcbuild. Exe”.
- npm run dev Error: opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]
- [Solved] Node.js v17 npm run dev Error: opensslErrorStack
- [Solved] MSBUILD : error MSB3428: Could not load the Visual C++ component “VCBuild.exe“
- runtime-core.esm-bundler.js5c406620 [Vue warn] Unhandled error during execution of native event h
- [Solved] Vue Compile Error: JavaScript heap out of memory
- package.json Scripts configuration environment variable distinguishes development environment from production environment
- [Solved] Vue-cli3 running or packaging error: JS memory overflow
- [Solved] Error Rule can only have one resource source (provided resource and test + include + exclude)
- [Solved] Error Rule can only have one resource source (provided resource and test + include + exclude)
- [Solved] ERROR Error: Cannot find module ‘vue-loader-v16/package.json‘
- React: How to Solve Web3 import error