error:03000086:digital envelope routines::initialization error problem solving

Table of contents

Problem description: error:03000086:digital envelope routines::initialization error

Cause of the problem: The nodejs V17 version released OpenSSL3.0, which adds stricter restrictions on the algorithm and key size. Versions before nodeJs v17 have no effect, but this error will occur in V17 and later versions.

solution:

Method 1: Enter the command from Vscode or cmd command line

Method Two: 


In the vue front-end project command box, enter npm run serve or npm run dev

Report error:03000086:digital envelope routines::initialization error

Error: error:0308010C:digital envelope routines::unsupported   
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\webpack\lib\NormalModule.js:471:10)
    at D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\webpack\lib\NormalModule.js:503:5
    at D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\webpack\lib\NormalModule.js:358:12
    at D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array.<anonymous> (D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\Code\VueProject\iss-edu-platform-online-front-all\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9   
    at D:\Code\VueProject\iss-edu-platform-online-front-all\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.17.1

 

Problem Description:

Due to reinstalling the system, all node.js has been reinstalled. The current node.js version is 18.7.1. Some old projects report errors when using them:

  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'

problem causes:

The NodeJs V17 version released OpenSSL3.0, which adds stricter restrictions on the algorithm and key size. Versions before nodeJs v17 are not affected, but this error will occur in V17 and later versions. The old project is nodeJS16 version.

solution:

Due to version differences, the best solution to adapt to old projects is to return to the old version. But technology is always being updated iteratively, so I chose to stay with the current version and solve the problem simply and directly.

Method 1: Enter the command from Vscode or cmd command line

$env:NODE_OPTIONS="--openssl-legacy-provider"

 Make the node version on the computer adapt to the project version.

Then execute npm run serve and the project can be run successfully.

 

Method Two: 

Find the package.json file and add: set NODE_OPTIONS=--openssl-legacy-provider && as follows:

"dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --open",

 Personally, method one is better, and I recommend everyone to use method one. Every project in the province needs to be configured.

Guess you like

Origin blog.csdn.net/weixin_46474921/article/details/132969114