解决报错:rror: error:0308010C:digital envelope routines::unsupported
报错详细内容:
INFO Starting development server...
10% building 2/5 modules 3 active ...er\lib\index.js!F:\vscode\packages\vue-elementui-hrm\src\main.jsError: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:68:19)
at Object.createHash (node:crypto:138:10)
at module.exports (F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\NormalModule.js:471:10)
at F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\NormalModule.js:503:5
at F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\NormalModule.js:358:12
at F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
node:internal/crypto/hash:68
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:68:19)
at Object.createHash (node:crypto:138:10)
at module.exports (F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\NormalModule.js:471:10)
at F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\NormalModule.js:503:5
at F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\lib\NormalModule.js:358:12
at F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at Array.<anonymous> (F:\vscode\packages\vue-elementui-hrm\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at F:\vscode\packages\vue-elementui-hrm\node_modules\webpack\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
at F:\vscode\packages\vue-elementui-hrm\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
解决方案:
调整package.json文件内的scripts配置块。
"scripts": {
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
"lint": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint"
},