解决报错:rror: error:0308010C:digital envelope routines::unsupported

报错详细内容:

bash 复制代码
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配置块。

bash 复制代码
"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"
  },
相关推荐
余生H5 分钟前
前端Python应用指南(二)深入Flask:理解Flask的应用结构与模块化设计
前端·后端·python·flask·全栈
outstanding木槿9 分钟前
JS中for循环里的ajax请求不数据
前端·javascript·react.js·ajax
酥饼~16 分钟前
html固定头和第一列简单例子
前端·javascript·html
一只不会编程的猫20 分钟前
高德地图自定义折线矢量图形
前端·vue.js·vue
所以经济危机就是没有新技术拉动增长了20 分钟前
二、javascript的进阶知识
开发语言·javascript·ecmascript
m0_7482509322 分钟前
html 通用错误页面
前端·html
来吧~31 分钟前
vue3使用video-player实现视频播放(可拖动视频窗口、调整大小)
前端·vue.js·音视频
Bubluu31 分钟前
浏览器点击视频裁剪当前帧,然后粘贴到页面
开发语言·javascript·音视频
鎈卟誃筅甡44 分钟前
Vuex 的使用和原理详解
前端·javascript
呆呆小雅1 小时前
二、创建第一个VUE项目
前端·javascript·vue.js