node.js 更新 v19版本后提示 ERR_OSSL_EVP_UNSUPPORTED解决办法

{
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

以上为错误提示信息,解决办法如下:

windows

在package.json运行命令的地方加上 set NODE_OPTIONS=–openssl-legacy-provider,如:


  "scripts": {
    "dev": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
    "build:prod": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build"
  },

mac/linux


  "scripts": {
    "dev": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
    "build:prod": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build"
  },

通过简单调整,解决问题。

This entry was posted in 应用. Bookmark the permalink.

发表评论