解决 Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypt

问题:Ubuntu VSCode 命令行运行 npm run serve 报错:

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)

参考: How To Fix Error - "Digital Envelope Routines::Unsupported" in Node.js or React ? - Gankrin

解决 Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypt_第1张图片

 

解决方法:

 找到项目package.json 文件,修改如下:

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

你可能感兴趣的:(vue.js,javascript,前端)