code: 'ERR_OSSL_EVP_UNSUPPORTED' 报错解决

报错:

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at BulkUpdateDecorator.hashFactory (D:\WzProject\wz-middle-ground-frontend\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:184161:18)
    at BulkUpdateDecorator.update (D:\WzProject\wz-middle-ground-frontend\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:184062:50)
    at D:\WzProject\wz-middle-ground-frontend\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:107101:9
    at D:\WzProject\wz-middle-ground-frontend\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:33829:16
    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'
}

解决办法:

在start 和build 命令前加上 

SET NODE_OPTIONS=--openssl-legacy-provider

也可以node退回16版本

 

posted @ 2024-02-19 14:25  我辈年轻  阅读(2308)  评论(0编辑  收藏  举报