错误信息

Error: error:0308010C:digital envelope routines::unsupported
    ······
  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.15.0

问题描述:使用npm run serve时报出以上错误

原因node版本过高(v18.15.0)

解决办法:在项目的 package.json 里面的 seripts” 标签里面配置以下内容

"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build"

结果

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注