NODE版本更新后报错
- 原来的版本是node 16
- 更新到18后报错
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
3.node.js 的版本问题,因为 node.js V17版本中最近发布的OpenSSL3.0, 而OpenSSL3.0对允许算法和密钥大小增加了严格的限制,可能会对生态系统造成一些影响。故此以前的项目在升级 nodejs 版本后会报错。
1.推荐:修改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"
},
2.最好的办法还是降级为node16继续使用