vue项目 package.json 配置
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
启动服务
npm run serve
错误信息
Starting development server...
10% building 2/5 modules 3 active ...\node_modules\webpack\hot\dev-server.jsError: error:0308010C:digital envelope rout
tines::unsupported
at new Hash (node:internal/crypto/hash:69:19)
at Object.createHash (node:crypto:133:10)
at module.exports
.....
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.18.0
解决方法
在package.json 启动配置中添加配置
set NODE_OPTIONS=--openssl-legacy-provider
package.json 完整配置写法
"scripts": {
"serve": "set NODE_OPTIONS=--openssl-legacy-provider&&vue-cli-service serve",
"build": "vue-cli-service build"
},