← coderrocketfuel.com

Fix the "error:0308010C:digital envelope routines::unsupported" Error in Create-React-App

After you install everything and try to run a Create-React-App application, you may get the Error: error:0308010C:digital envelope routines::unsupported error in your console.

To fix this, open your package.json file and update the "start" script to this:

"start": "react-scripts --openssl-legacy-provider start"

After you save the package.json file and restart your application, the error should be gone.

The --openssl-legacy-provider flag should also be added to your other scripts (e.g. build, dev, etc.).

Due to some changes in Node.js v17, --openssl-legacy-provider was created to handle key size in OpenSSL.

So this issue is likely happening because of the version of Node.js you're using to run Webpack.

If you don't want to update your package.json file, you can also add a NODE_OPTIONS options flag to your CLI commands or .env file:

NODE_OPTIONS="--openssl-legacy-provider"

This will set that flag throughout your entire application. And should stop the error from being thrown.

Thanks for reading and happy coding!