You can try the following options to resolve the issue:
After installing NVM, follow these steps:
export NODE_OPTIONS=--openssl-legacy-provider
set NODE_OPTIONS=--openssl-legacy-provider
$env:NODE_OPTIONS = "--openssl-legacy-provider"
Follow these steps in your terminal within the current app directory:
npm install -g npm-check-updates
: Installs the npm-check-updates
package globally, which is used to check for updates to your dependencies.ncu
: Displays the dependencies alongside their new versions listed in your package.json
file, indicating the upgrades recommended.ncu -u
: Updates the versions listed in your package.json
file to match the new versions found.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.
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:
Additionally, the error may occur because you're using Node 17.
There are at least three ways to fix this error:
--openssl-legacy-provider
to the start script like this: react-scripts --openssl-legacy-provider start
.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:
npm outdated
command to identify and update any outdated packages.