P粉9880258352023-08-25 00:33:37
Perform the following steps in the current application directory on the terminal:
npm install -g npm-check-updates
Install the npm-check-updates package globally to do exactly what its name says.
ncu
This will display the dependency side by side with its new version (it is recommended that you upgrade to) the version listed in (the arrow points to) the package.json file in the current directory.
ncu -u
This will update your package.json file with the new version listed and prepare your application for the next step (correct update).
npm update
or
npm install
Both of these will eventually install new updates; fixing the problem.
Note: I have used
npm install
I ran into this issue using an old React.js app cloned from github but didn't want to downgrade to an older node version since I just upgraded from node v14 to v18.13.0. Again, downgrading is not a safe option. There are many reasons for updating; most of the time, "security reasons", especially in the JavaScript world.
P粉5054505052023-08-25 00:15:16
Now there are two options -
You can reinstall the current LTS Node.js version from its official website . Or download more specific content from here;
You can use NVM (Node Version Manager)
Linux and macOS (Windows Git Bash)-
export NODE_OPTIONS=--openssl-legacy-provider
Windows Command Prompt-
set NODE_OPTIONS=--openssl-legacy-provider
Windows PowerShell-
$env:NODE_OPTIONS = "--openssl-legacy-provider"