[Solved]-Node.js 17.0.1 Gatsby error - "digital envelope routines::unsupported ... ERR_OSSL_EVP_UNSUPPORTED"


Node.js 17.0.1 Gatsby error - "digital envelope routines::unsupported ... ERR_OSSL_EVP_UNSUPPORTED"

You can try the following options to resolve the issue:

  1. Attempt to uninstall Node.js version 17+ and reinstall Node.js version 16+.
  2. You can reinstall the current LTS (Long-Term Support) Node.js version from the Official site. Alternatively, you can download specific versions from here.
  3. Utilize NVM (Node Version Manager) for managing Node.js versions:

After installing NVM, follow these steps:

  • For Linux and macOS (Windows Git Bash), open a terminal and run:
  • export NODE_OPTIONS=--openssl-legacy-provider
  • For Windows command prompt, run:
  • set NODE_OPTIONS=--openssl-legacy-provider
  • For Windows PowerShell, run:
  • $env:NODE_OPTIONS = "--openssl-legacy-provider"

Follow these steps in your terminal within the current app directory:

  1. npm install -g npm-check-updates: Installs the npm-check-updates package globally, which is used to check for updates to your dependencies.
  2. ncu: Displays the dependencies alongside their new versions listed in your package.json file, indicating the upgrades recommended.
  3. ncu -u: Updates the versions listed in your package.json file to match the new versions found.
  4. npm update or npm install: Finally, install the new updates to fix the problem.

It's recommended to run either npm update or npm install to install the updates. In your case, you encountered this issue with an old React.js app and opted to use npm install.

You are likely encountering this error because you are using, or one of the dependent packages is using, Webpack with a version less than 5.

To verify the Webpack version, you can use the following commands:

  • npm list webpack
  • yarn list webpack

An example output might look like this:

├─ [email protected]
│  └─ [email protected]
└─ [email protected]

In this example, Webpack 5 is installed, but one of the dependency packages is still referencing Webpack 4.

The solution is to update the dependency package to the latest version that uses Webpack 5. If the latest version of the dependency package still uses Webpack 4, you may need to install Node.js version 16 instead.

"error:03000086:digital envelope routines::initialization error on Vue.Js Project"

If you're working with Node.js and command-line interface tools such as Webpack, create-react-app, or vue-cli-service, you might have encountered the error message:

Error: error:0308010c:digital envelope routines::unsupported.

The "0308010c:digital envelope routines::unsupported" error can occur due to two main reasons:

  1. You're not using the LTS (Long-Term Support) version of Node.js. For instance, if you're using Node 17.0.0, which is not an LTS version.
  2. You're using react-script with a version less than 5.

Additionally, the error may occur because you're using Node 17.

How to Fix the "0308010c:digital envelope routines::unsupported" Error

There are at least three ways to fix this error:

  1. Pass --openssl-legacy-provider to Webpack or the CLI Tool: In a React app, for example, you can pass --openssl-legacy-provider to the start script like this: react-scripts --openssl-legacy-provider start.
  2. Use an LTS Version of Node.js: Consider downgrading your Node version to 16.16.0 or other LTS versions. Currently, 18.12.1 is the latest LTS version of Node.
  3. Upgrade React Script to Version 5+: If you're working with React and the above fixes don't work, it might be an issue with your React script version. If you're using a React script version less than 5, upgrade it to version 5+.

In the case mentioned, the user was using react-scripts 3.4.3. To upgrade react-scripts to version 5+, they can either uninstall and reinstall react-scripts or manually change the react script version in the package.json file and then reinstall the dependencies.

After upgrading the version of react-scripts to 5+, the React app should work fine.

To resolve the Node.js 17.0.1 Gatsby error - "digital envelope routines::unsupported ... ERR_OSSL_EVP_UNSUPPORTED", you can try the following steps:

  1. Update your Node.js version to a supported one. While Node.js 17.0.1 might have introduced some changes or issues that affect Gatsby, switching to a stable or LTS (Long-Term Support) version of Node.js could resolve the problem.
  2. Check if your Gatsby project dependencies are up-to-date. Sometimes, compatibility issues arise due to outdated dependencies. Use the npm outdated command to identify and update any outdated packages.
  3. Review your Gatsby project configuration and plugins. Certain plugins or configurations might not be compatible with newer versions of Node.js. Try disabling or updating plugins one by one to identify the source of the error.
  4. If the error persists, consider searching for any reported issues or troubleshooting guides related to Gatsby and Node.js 17.0.1 on forums, GitHub repositories, or community channels. Other developers might have encountered similar issues and provided solutions or workarounds.
  5. As a temporary workaround, you can try downgrading your Node.js version to a previous stable release that is known to work well with Gatsby until a permanent solution is found.