- Published on
Resolving OpenSSL Error in Node.js 20 for Next.js Projects
- Authors
- Name
- Jeevan Wijerathna
- @iamjeevanvj
Resolving OpenSSL Error in Node.js 20 for Next.js Projects
When upgrading your Node.js version to 20.x.x, you might encounter an OpenSSL error during the build process. This error can be resolved by using the legacy OpenSSL provider. Here’s a quick guide to fix this issue.
Steps to Resolve the Error
Update package.json Scripts:
Modify the build script in your
package.json
--openssl-legacy-provider
{ "scripts": { "build": "node --openssl-legacy-provider ./node_modules/.bin/next build" } }
Rebuild the Project:
After updating the
package.json
npm run build
Explanation
The
--openssl-legacy-provider
ERR_OSSL_EVP_UNSUPPORTED
By following these steps, you can successfully build your Next.js project with the latest Node.js version.