The nodejs upgrade caused the project to report an error FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context

When running the old vue3 project, I found an error in the console, as follows:

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’

Screenshot below:
Insert image description here

reason:

My local nodeJs has been upgraded to v18+. This vue3 code was originally created in v14+. Most likely it is due to the upgrade.

Solution:

Solve the problem of modifying environment variables :

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

Then run the code again, ok!

Guess you like

Origin blog.csdn.net/weixin_39550080/article/details/132538154