Vue2报错opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]

一、Vue2项目启动,项目编译报错

 opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],

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 (D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\webpack\lib\util\createHash.js:135:53)
    at NormalModule._initBuildHash (D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\webpack\lib\NormalModule.js:417:16)
    at handleParseError (D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\webpack\lib\NormalModule.js:471:10)
    at D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\webpack\lib\NormalModule.js:503:5
    at D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\webpack\lib\NormalModule.js:358:12
    at D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\loader-runner\lib\LoaderRunner.js:373:3
    at iterateNormalLoaders (D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
    at Array. (D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
    at Storage.finished (D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
    at D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
    at D:\QLWork\QL.Site\QL.Site.YJ02\QL.Back.Vue\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'
}

Vue2报错opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]_第1张图片

二、解决方案:

1.报错原因

新版nodejs框架,vuecli框架,编译老板的vue2时候会报错。

解决方案:从package.json文件中 启动编译 set NODE_OPTIONS=--openssl-legacy-provider

  "scripts": {
    "serve": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
    "build": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
    "lint": "vue-cli-service lint"
  },

Vue2报错opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]_第2张图片

更多:

Vue组件(二)父组件、子组件通信/传值

Vue组件(一)Vue组件基础_Vue组件入门

Vue3实现复制功能_vue-clipboard3 Vu3复制插件

你可能感兴趣的:(Vue,webpack,前端,node.js,vue2)