使用yarn serve报错如下
Node.js v17.9.1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
 

解决办法

export NODE_OPTIONS=--openssl-legacy-provider

这句命令是在设置 Node.js 环境变量 NODE_OPTIONS,将其值设置为 --openssl-legacy-provider。

在 Node.js 的默认加密库中,OpenSSL 版本可能已经过时,而 --openssl-legacy-provider 参数告诉 Node.js 在使用 OpenSSL 加密库时使用旧的版本。这可以解决一些使用较新版本 OpenSSL 出现的兼容性问题。

还可以启动时设置 

在package.json 中启动时增加

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

更多推荐