. Advertisement .
..3..
. Advertisement .
..4..
The error: “Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
Why do you get the error: “Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported”?
You have recently updated your node to the most recent version. However, since updating to the current version, your project has sent the following problem while creating.
Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
The reason of this error “Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported” is that you use Docker build create the application because it automatically downloads the most recent Node.JS version. However, OpenSSL3, which node.js 17 utilizes, has updated the code for initializing the context of the MD family (containing MD4), is a breaking change. The latest stable version of Node JS is version 17. It is incompatible with webpack version 4, so the error happens.
How to solve the ”Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported” error
Approach 1: Downgrade node to v14.18.1
The simplest and most straightforward approach to solve this issue ”Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported” is to downgrade the node to version 14.18.1. Then, simply remove node modules and build your project again, and your problem should be resolved.
Approach 2: Include NODE_OPTIONS
All you have to do is typing this command into your terminal. Let’s utilize the gitbash terminal on Windows.
export NODE_OPTIONS=--openssl-legacy-provider
Alternatively, for Windows, execute this command.
set NODE_OPTIONS=--openssl-legacy-provider
Now, you have fixed your issue.
Approach 3: Modify start line in package.json
Another way for fixing this problem is changing this line in your package.json.
"start": "react-scripts start"
to
"start": "react-scripts --openssl-legacy-provider start"
Now, your issue must be fixed.
Approach 4: Utilize LTS version
All you have to do is utilize the LTS version of node. This issue may occur if you are utilizing a version other than the LTS version. Check out the LTS version here.
Install nvm:
install 16.13.0 nvm
Approach 5: Supplement the legacy OpenSSL in package.json
Adding the legacy OpenSSL in package.json is a great way to resolve “Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported” error. In the case you still wish to use Node.js 17 or later to fix the problem, you can edit the following line in package.json.
From
"start": "react-scripts start"
To
"start": "react-scripts --openssl-legacy-provider start"
Changing this package’s script in package.json forces Node.js to operate in legacy mode with OpenSSL 3, which means you are using known vulnerable algorithms.
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Read more
→ Solve The Error: “Error: error:0308010C:digital envelope routines::unsupported in reactjs”
Leave a comment