Fixed: error:0308010c:digital envelope routines::unsupported

Getting error “error:0308010c:digital envelope routines::unsupported”, means you are not using the LTS Node JS version or have issues with cryptographic, or it does not support OpenSSL algorithms; To fix the error, you have to update Node JS and OpenSSL version or reinstall Node JS.

How to fix error:0308010C:digital envelope routines

Here are solutions that you can use to fix the error: “error: error:0308010c:digital envelope routines::unsupported”:

Solution 1: Update all npm packages in your app

Simply open your cmd or terminal window and use npm upgrade to update all the npm packages in your app to fix error:0308010C:digital envelope routines::unsupported.

npm upgrade

If still not fixed this error, you can execute the following command on terminal or command prompt:

npm audit fix --force

Solution 2: Upgrade to Webpack 5 (Latest Version)

Still, if you are using an older version of Webpack (example Webpack v4) then you need to upgrade your Webpack version to v5.61.0.

npm install webpack@latest

Note: Please be aware that this solution may not work if you are using create-react-app or vue-cli to create your JavaScript application. For those specific frameworks, please follow the alternative solution provided below.

Solution 3: Add –openssl-legacy-provider flag to your build script

In this solution, you can add the --openssl-legacy-provider flag to the build script defined in package.json.

The OpenSSL legacy provider is a set of outdated algorithms that are no longer commonly used, including MD2, MD4, MDC2, and others.

To fix this error, you need to add the flag to your build script to enable the “md4” or any other legacy algorithm.

For react js

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

For vue js

{
  "scripts": {
    "serve": "vue-cli-service serve --openssl-legacy-provider"
  },
}

If you encounter an error message stating “Error: Unknown argument: openssl-legacy-provider,” you can resolve it by setting the NODE_OPTIONS environment variable before running the build command. Follow the steps below to apply this change:

Open your command prompt or terminal. Set the NODE_OPTIONS environment variable by running the appropriate command based on your operating system:

For Windows:

set NODE_OPTIONS=--openssl-legacy-provider

For Mac:

export NODE_OPTIONS=--openssl-legacy-provider

After setting the environment variable, run the build command for your project. The build command may vary depending on your specific project setup. Here’s an example using the React build command:

npm run build

Solution 4: Upgrade react-scripts to v5

To resolve this error, you can upgrade the react-scripts package to version 5 if you are using Create React App. Please follow the instructions below:

Open your command prompt or terminal and execute the following command into it to resolve it:

# For npm:
npm install react-scripts@5

# For Yarn:
yarn add react-scripts@5

Once the execution is complete, you should be able to run the npm start or yarn start command without encountering the error.

Solution 5: Use Latest LTS version of Node.js

To address the issue, it is recommended to use the LTS (Long-Term Support) version of Node.js. If you are encountering the “error:0308010C:digital envelope routines::unsupported” error, you can try the following troubleshooting steps:

Step 1: Update npm and Node.js Certificate Authority (CA) Certificates

Update npm to the latest version by running the command:

npm install -g npm@latest

Update Node.js Certificate Authority (CA) certificates by running the command:

npm install -g update-ca-certificates

Step 2: Clear npm cache

Clear the npm cache by running the command:

npm cache clean --force

Step 3: Reinstall the affected package

Remove the package causing the error. Replace your-package-name with the actual name of the package. For example:

npm uninstall your-package-name
npm install your-package-name

These troubleshooting steps can help resolve the “error:0308010C:digital envelope routines::unsupported” error. If the issue persists, you may consider seeking further assistance on platforms like consulting the package’s documentation or support channels for specific guidance related to that package.

Solution 6: Downgrade to an older version: Node.js V16

If none of the previously mentioned solutions resolved the error, you can try downgrading Node.js to version 16 as a last option. If you are using nvm (Node Version Manager), follow the below-given instructions:

Open your command prompt or terminal and execute the following command into it to resolve it:

# Install version 16 LTS version
nvm install 16.20.0

# use Node 16.20.0

nvm use 16.20.0

Next, follow these steps to resolve the error:

  1. Open your command prompt or terminal.
  2. Navigate to the root directory of your project.
  3. Delete the node_modules folder by running the command:
    • rm -rf node_modules
  4. Delete the package-lock.json file by running the command:
    • rm package-lock.json
  5. Now, re-install all your npm packages by running the command:
    • npm install
  6. Once the installation is complete, you can rebuild your application if necessary.
  7. Finally, run the npm start command to start your application, and the error should be resolved.

Conclusion

That’s all, you have found 6 solutions to solve the error: 0308010C: Digital envelope routine :: unsupported.

Recommended Tutorials

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *