'Npm not working (openSSL configuration error windows10x64)

I was getting this error whenever I try the npm command in powershell:

**~ $ node -v
v17.1.0
~ $ npm -v
OpenSSL configuration error:
74240000:error:80000003:system library:BIO_new_file:No such process:c:\ws\deps\openssl\openssl\crypto\bio\bss_file.c:67:calling fopen(C:\Program Files\PostgreSQL\psqlODBC\etc\openssl.cnf, rb)
74240000:error:10000080:BIO routines:BIO_new_file:no such file:c:\ws\deps\openssl\openssl\crypto\bio\bss_file.c:75:
74240000:error:07000072:configuration file routines:def_load:no such file:c:\ws\deps\openssl\openssl\crypto\conf\conf_def.c:179:
OpenSSL configuration error:
A8250000:error:80000003:system library:BIO_new_file:No such process:c:\ws\deps\openssl\openssl\crypto\bio\bss_file.c:67:calling fopen(C:\Program Files\PostgreSQL\psqlODBC\etc\openssl.cnf, rb)
A8250000:error:10000080:BIO routines:BIO_new_file:no such file:c:\ws\deps\openssl\openssl\crypto\bio\bss_file.c:75:
A8250000:error:07000072:configuration file routines:def_load:no such file:c:\ws\deps\openssl\openssl\crypto\conf\conf_def.c:179:**

Another thing I noticed is that the node must have updated incorrectly because even though it gives me a version, I cannot uninstall it and cannot find the install files in my program files. I am at a total loss and about to just reset my computer to default. I want to repair it but everything online tells me to use npm, which in itself is not possible.

I have tried using the "set OpenSSL" command to empty or to a dummy file but it does not seem to do anything.



Solution 1:[1]

Go to the Windows control panel and click on Uninstall a program, select Node.js and click on the uninstall tab to uninstall the node and npm successfully. Restart your system. Then go to https://nodejs.org/en/ to download 16.13.0 LTS version and install it

Solution 2:[2]

Had this issue in a conda environment. Fixed by installing node with next command: conda install -c conda-forge nodejs=16.3.2

Solution 3:[3]

Try to uninstall the node from your project directory.

npm uninstall node

Most probably you have 2 different versions of Node installed on your system.

If my solution does not work for you. Try the other suggestions with uninstalling Node from the system.

Solution 4:[4]

My solution was to use another node version in this case 15.8.0, you can try with others most recently versions. When I did this npm was installed correctly:

enter image description here

Solution 5:[5]

Please check environment path using PowerShell

check environment path:

cmd /c echo %PATH%' or 'cmd /c echo %OPENSSL_CONF%

You will get C:\Program Files\PostgreSQL\psqlODBC\etc\openssl.cnf path so reset the environment path for openssl using below comment on PowerShell

set OPENSSL_CONF=''

after that, the problem will be fixed.

this issue already issued on Nodejs GitHub. https://github.com/nodejs/node/issues/40547

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ethan
Solution 2 David Bacter
Solution 3 Bilal Ahmad
Solution 4 Ethan
Solution 5 Tyler2P