解决报错: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"
  },
相关推荐
前端Hardy12 分钟前
HTML&CSS:比赛记分卡
前端·javascript·css·3d·html
疯狂的沙粒38 分钟前
Vue项目开发 element-UI 前端实现 1到10排列选择的按钮
前端·vue.js·ui
刺客-Andy43 分钟前
React第六节 组件属性prop的propTypes类型使用介绍
前端·javascript·react.js·typescript
Mr.Liu61 小时前
小程序24-滚动效果:scroll-view组件详解
前端·微信小程序·小程序
是萝卜干呀1 小时前
Frontend - 防止多次请求,避免重复请求
javascript·ajax·jquery·防抖·节流·disabled属性
三金121382 小时前
局部使用Vue
前端·javascript·vue.js
LinXunFeng2 小时前
Flutter - 子部件任意位置观察滚动数据
前端·flutter·开源
许静知2 小时前
第十章 JavaScript的应用
开发语言·javascript·ecmascript
好开心332 小时前
js高级06-ajax封装和跨域
开发语言·前端·javascript·ajax·okhttp·ecmascript·交互
小镇程序员2 小时前
vue2 src_Todolist消息订阅版本
前端·javascript·vue.js