解决nodejs报digital envelope routines::unsupported错误的方法

INFO Starting development server...

10% building 2/3 modules 1 active ...\@vue\cli-plugin-eslint\node_modules\eslint-loader\index.js??ref--13-0!D:\2023project\traffic-ui\src\main.js

 

Error: error:0308010C:digital envelope routines::unsupported

问题:nodejs新版本引起的:digital envelope routines::unsupported

解决方案;(4条消息) nodejs新版本引起的:digital envelope routines::unsupported_yygr的博客-CSDN博客

1.推荐:找到package.json文件--scripts---serve--build---给这两个参数加同一段代码,SET NODE_OPTIONS=--openssl-legacy-provider && 

以下是修改,在相关构建命令之前加入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"
},

这种可以一劳永逸,以后直接通过npm执行scripts里面的命令即可。不管是项目迭代,还是团队开发,这种都比较有效。

 

posted @ 2023-06-01 14:37  up-zyn  阅读(679)  评论(0编辑  收藏  举报