This might help. Add these scripts in the package.json file.
React:
"scripts": {
    "start": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
    "build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"
}
If you are on Windows and you are using React.js you can use set instead of export in your scripts as follows:
"scripts": {
    "start": "set SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts start",
    "build": "set SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build"
}
or
"scripts": {
    "start": "react-scripts --openssl-legacy-provider start",
    "build": "react-scripts --openssl-legacy-provider build",
}
Vue.js:
"scripts": {
    "serve": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
    "build": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
    "lint": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service lint"
},
If you are on Windows and you are using Vue.js you can use set instead of export in your scripts as follows:
"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"
},
or
"scripts": {
    "serve": "vue-cli-service --openssl-legacy-provider serve",
    "build": "vue-cli-service --openssl-legacy-provider build",
    "lint": "vue-cli-service --openssl-legacy-provider lint"
},
Angular:
"scripts": {
 "start": "set NODE_OPTIONS=--openssl-legacy-provider  && gulp buildDev && ng serve ",
 "publish": "set NODE_OPTIONS=--openssl-legacy-provider  && gulp build && ng build --prod",
},