npm报错: four@0.1.0 serve: `vue-cli-service serve` error:03000086:digital envelope

339 阅读1分钟

image.png 之前的老项目,需要二开,npm run serve 一直报错。

纳闷,代码完全没动过

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! four@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the four@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

反复调试过程中发现。

1、不仅是老项目创,建脚手架只要,加上了版本号 @4或其他,项目启动必出报错

2、不加版本号,项目创建成功启动但自动生成了vue.config.js文件。初步肯定,npm不是曾经那个npm

image.png

解决过程

3、查了很多,差不多的问题,答案。

【1、删node包,2、降版本,3、查package.json 有无cli,4、换镜像 ,5、用yarn】

最终:找到一个,没见过的报错,猜到的可能原因,尝试了一下

error:03000086:digital envelope routines::initialization error

1、原项目是在[nodejs]16版本上跑,目前升级为nodejs 18,可能是由于升级影响的
2、具体错误原因:ERR_OSSL_EVP_UNSUPPORTED 错误SSL 数字信封不支持

问题解决:

vscode 工程项目下执行:

$env:NODE_OPTIONS="--openssl-legacy-provider"

npm run serve image.png

道阻且长