Below node and npm version works for this project.
"engines" : {
"npm" : "6.14.18",
"node" : "14.21.3"
}
Use .nvmrc file to set the exact node version to be used during the build in Netlify.
Remove --openssl-legacy-provider NODE_OPTIONS environment variable for node version 14.21.3