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
I have tried with multiple node and npm versions and still, the problem remains the same for me.
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
¯\_(ツ)_/¯
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/
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.
Catch this error after npm i. Version npm - 8.0.0, nodejs - 16.11.0.
npm ERR! Cannot read properties of undefined (reading 'isServer')
I had the same issue with close versions of node and npm. I was using a shared connection from my phone since I wasn't home. When I get back home and used my WiFi things got back to normal.
If you are using such kind of connection then it is probably that causes this issue.
Try to use npm with specific version
for example i was trying to use npm install -g truffle and it did not work
but this one work npm install -g truffle#5.0.5
I updated npm and that fixed it!
You can update npm like so:
npm install -g npm#latest
If running this command doesn't work then you can try installing npm packages in an Admin Environment.
Hope this helps!
The issue could be due to the network, try to change the network and retry. This solved my issue :)
I've got the same issue, then I updated npm to 8.3.0, and the problem is solved.
Copying the npmrc.5 file from:
C:\Program Files\nodejs\node_modules\npm\man\man5 to C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm seemed to work for me:
Copy-Item -Path C:\Program Files\nodejs\node_modules\npm\man\man5 -Destination C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm –Passthru
Try stable Nodejs version 14.16.1 instead of 16.
Nodejs 14.16.1 Link
Update the latest version of Node.js. Then try to install npm the issue won't come.
Check out this URL https://nodejs.org/en/
and install a version recommended for most users.
I had this same issue, turning off all port forwarding on my router helped.
Whenever, I saw this problem. I restarted the computer and it working immediately.
I recommend trying this solution.
Based on what I've read on issues related, it seems like there's conflicting global packages and node versions.
Please try uninstalling both node and npm and try again.
Check out these issues for more details:
Node error Cannot read property 'resolve' of undefined
Cannot read property 'resolve' of undefined when using npm to install a package
I had the same issue and tried all the possible solutions. None of them worked.
And finally, when I restarted my PC, it worked like a charm :).
It happened to me because of the node.js version and an npm update.
Uninstall nodejs
Delete folder C:\Users\Administrator\AppData\Roaming\npm
Install nodejs (v17.x)
In your project folder:
npm install -g npm#8.3.2
npm i --package-lock-only
npm audit fix --force
It worked for me. I hope it helps you :)
When I had this problem, I was trying to deploy my NodeJs server in Heroku. The problem was I forgot to load the enviroment variables manually, so it was related to the connection to the DB, that was failing.
It happened also locally for the same reason and it was still related to the failing connection to the DB.
I kept running into this problem in different scenarios. I found that because I had used a VPN during my computer session, but not during the time I ran 'npm install', it was throwing this error. I simply reinstalled and restarted and did not enable my VPN during that session. Although, you may not have to completely reinstall-- only restart you PC without using a VPN after restart-- I do not know as I have not tried.
(Specifically I was using Express VPN)
Update: I ran into the problem again immediately after a fresh install and restart. Again I restarted my computer (without a fresh install as I had just reinstalled it.) This seemed to work for the moment. Will update with any permanent fixes I come across.
I am completely new to topic of Node to be honest, but I can't find the answer for my question. I have Ubuntu 18.04 on my WSL, and want to install some tool called jscpd on my WSL. I have already done apt-get update and installed npm packages etc. To install jscpd, I use npm install -g jscpd and this causes showing some loading bar which never ends. Installing another things also does not work. Can you tell me whan can be a problem in it?
Okay, after some time I found the answer - essential was that I am behind company's proxy, and npm does not take info from .bashrc about proxy settings, so you have to set them independently by
npm config set http-proxy http://proxy_host:port
npm config set https-proxy http://proxy_host:port -> yes, as a https you should write http, not https, this is not figured out why.
I inherited a React project and after getting the latest code it failed to run - the previous developer isn't available. So, with no experience, I got on with it
Here's a list of the thing I did:
Updated Node to latest
Updated NPM to latest
Updated VS Code to latest
Removed package-lock.json
Ran a bunch of npm<whatever> commands that are littered all over internet
The coup de grâce was when I deleted all the packages from node_modules
So, now I can't even get npm install --verbose to work. It just hangs and gives no feedback. I can't reinstall Node because the jokers here got us locked-down.
What can I do to install the packages? Am I doomed?
UPDATE: I disconnected from the network and went on the company wifi and npm install worked. How can that be?
Due to your update - probably your machine is behind the company proxy, that's why npm cannot get packages. To fix this find your proxy address, and after this run in terminal:
npm config set proxy http://yourproxy.company.com:8080
npm config set https-proxy http://yourproxy.company.com:8080
I found this method on https://jjasonclark.com/how-to-setup-node-behind-web-proxy/, works very good.
I am not able to install packages using npm. I keep getting error shown in below image.
Using link1, link2, link3 I uninstalled nodejs. After installing the nodejs again, when I run npm config ls command, I can still see proxy details which I added earlier.
How can I ensure that when I uninstall nodejs it also removes all the config files.
I was setting proxy as
npm config set http_proxy=http://myproxy address:8080
which is wrong now I use
npm config set proxy http://myproxy address:8080
and I am able to install packages.