4

Can't install node packages via npm or yarn

This has been happening to me since last month and I have tried multiple solutions from the internet including stack overflow solutions like https://stackoverflow.com/a/34945326/15488503

The problem is regenerated each time I run commands like

yarn install
npm install
npx create-react-app myapp

The error which I see mostly revolves around this error message -

ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC

enter image description here

I have tried with multiple node and npm versions and still, the problem remains the same for me.

enter image description here

4 Answers4

5

I had this problem when i was using internet via a USB Wifi adapter. Connected my computer with a cable solved my ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC problem ¯\_(ツ)_/¯

Yacine MEDDAH
  • 1,211
  • 13
  • 17
1

Besides updating your version of node to an active or current LTS you want to ensure your NPM registry is set to an HTTPS endpoint:

npm set registry=https://registry.npmjs.org/
0

After facing the issue for more than 6 months. I think I found a solution. It's VPN (virtual private network).

I realized that the issue was because of my network connection and was not a fault of NPM. Using VPN while downloading packages prevented that error.

However this also doesn't works all the time.

0

This happens when your Windows Firewall tries to block npm from downloading files from your connected network.

To fix this issue follow the steps below:

  1. Select "Windows Defender Firewall" in your Windows search bar: View image
  2. Click on "Allow an app or feature through Windows Defender Firewall": View Image
  3. Click on "Change Settings" button: View image
  4. Scroll to "Node.js Javascript Runtime" and make sure you select both public and private networks to allow npm to install files irrespective of your network. View image
  5. Finally, click "Ok" and now try re-installing the npm package.

If this does not work then try installing the dependencies by switching on VPN.