I have been trying to deploy my nuxt app to Vercel for a while now but I'm getting this error saying: Error: error:0308010C:digital envelope routines::unsupported
I solved the issue on my local machine downgrading my node.js to 16+ but this still occurs in the production environment. I tried to set the --openssl-legacy-provider
to the scripts object in my package.json but it had no effect. ps. I'm not so sure if the syntax was correct since most of the answers were for react.
Here's the whole error:
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/vercel/path0/node_modules/webpack/lib/util/createHash.js:135:53)
at NormalModule._initBuildHash (/vercel/path0/node_modules/webpack/lib/NormalModule.js:417:16)
at handleParseError (/vercel/path0/node_modules/webpack/lib/NormalModule.js:471:10)
at /vercel/path0/node_modules/webpack/lib/NormalModule.js:503:5
at /vercel/path0/node_modules/webpack/lib/NormalModule.js:358:12
at /vercel/path0/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/vercel/path0/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/vercel/path0/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/vercel/path0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
at /vercel/path0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
at /vercel/path0/node_modules/graceful-fs/graceful-fs.js:123: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'
}
Node.js v18.12.1
Error: Command failed with exit code 1: npx nuxt build --standalone --no-lock --config-file "nuxt.config.js" /vercel/path0
My package.json:
{
"name": "my-project",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate"
},
"dependencies": {
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/vercel-builder": "^0.24.0",
"@nuxtjs/vuetify": "^1.12.3",
"@stripe/stripe-js": "^1.46.0",
"cookie-parser": "^1.4.6",
"cookieparser": "^0.1.0",
"cors": "^2.8.5",
"express": "^4.18.2",
"gsap": "npm:@gsap/shockingly@^3.11.3",
"nuxt": "^2.14.6",
"nuxt-gsap-module": "^1.7.2",
"stripe": "^11.3.0",
"vuex-persistedstate": "^4.1.0"
}
}