nodejs升级,导致项目报错FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context

在跑老的vue3项目时,发现控制台报错,如下:

at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ],
library: ‘digital envelope routines’,
reason: ‘unsupported’,
code: ‘ERR_OSSL_EVP_UNSUPPORTED’

截图如下:
在这里插入图片描述

原因:

我本地的nodeJs升级到v18+了,这个vue3的代码当初时v14+的时候创建的。大概率是由于升级影响的。

解决方法:

修改环境变量问题解决

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

然后再运行代码,ok了!

猜你喜欢

转载自blog.csdn.net/weixin_39550080/article/details/132538154