NPM issue on Mac - node.js

I had been using VS Code for my development works, when all of a sudden my npm install commands stopped working and started giving me errors like below:
⸨░░░░░░░░░░░░░░░░░░⸩ ⠧ rollbackFailedOptional: verb npm-session abcd123456789efg
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/passport failed, reason: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ajaywadhwani/.npm/_logs/2019-01-27T22_33_38_087Z-debug.log
I am not behind any proxy by any chance.
Interestingly, a ping to the link https://registry.npmjs.org/passport through my browser takes me to the webpage with the content, and can ping the website through terminal.
Kindly advise and suggest.

Try updating to the latest npm with the command npm install npm#latest -g.
I would also make sure there's no proxy set up by going to System Preferences > Network > your connection (Wi-Fi, for example) > Advanced... > Proxies and looking for any checked boxes.
Please let me know if these solutions work or not.

Related

Linux terminal, npm install ETIMEDOUT

I installed nodeJs and npm using nvm, that went perfectly, then I notice that a newer version of npm was available so i try
npm install -g npm#latest
But then it just stays as like that, it's like it does not start never, so I try another command and this happens
npm install -g n
Same thing, noting happens.
Trying and trying I manage to get the following error:
/home/jonathan/.nvm/versions/node/v18.12.1/bin/npx --yes --package #angular/cli ng new untitled --defaults
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/#angular%2fcli failed, reason: connect ETIMEDOUT 2606:4700::6810:1123:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jonathan/.npm/_logs/2022-12-28T05_07_38_682Z-debug-0.log
Done
So searching on the internet I found the url npm uses to attempt the installs the following:
registry.npmjs.org <
I tried then:
ping registry.npmjs.org
Same as above, it does nothing, it suppose to show some info every few seconds but nothing happens so y put the url in a browser and it works
{"db_name":"registry","engine":"couch_bt_engine","doc_count":3313520,"doc_del_count":332,"update_seq":31421891,"purge_seq":0,"compact_running":false,"sizes":{"active":69891815727,"external":214417993712,"file":70327402736},"disk_size":70327402736,"data_size":69891815727,"other":{"data_size":214417993712},"instance_start_time":"1672130582611333","disk_format_version":7,"committed_update_seq":31421891,"compacted_seq":31421548,"uuid":"3a4ad341a4111dd254daa731f37b37ae"}
That's what it shows.
So. I don't know what it's going on, I'm not using any proxy or firewall. Need some help here.
Update... I try using wifi not wired connection and it works, so the problem appears to be wired connection
Solution remains on network configuration, as Robert says its not related to programming so I'm marking this as answer. Thank any who try to help

Error occurs when running npm install after creating VueJS project

I just installed VueJS and I tried creating a project. I followed their installation and quick start guide VueJS Getting Started.
> npm init vue#latest
> cd (My Project Name Here)
> npm install
However, after doing > npm install, it returns the following message in the VSCode Terminal:
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/lodash: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\alscg\AppData\Local\npm-cache\_logs\2022-04-07T08_54_47_537Z-debug-0.log
How do I fix this? Am I doing this wrong?
Please try this link it looks like it is answered already
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)

How can I install npm packages when I have a failed network request error?

I'm using a Mac with the zsh terminal, and I have node v16.13.1 on my machine.
I'm trying to install packages, but I haven't been successful. I get the error below, regardless of what package I try to install. I've also tried initializing first using npm -init, but I still get the same result.
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/figlet failed, reason: Client network socket disconnected before secure TLS connection was established
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/edgaracuna/.npm/_logs/2022-01-02T16_01_32_283Z-debug.log
How can I resolve this issue to be able to install node packages?
I was unable to recreate the issue, so I think this isn't a problem that you can directly solve. Either you have a firewall issue, or maybe the npm servers were down or broken at the time. Just try again later, reboot your computer or join a different wifi network.

I got this error while installing npm on my my angular project folder

Installing packages (npm)...npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/#babel%2fplugin-proposal-nullish-coalescing-operator: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\faizan\AppData\Local\npm-cache_logs\2021-12-07T00_42_46_255Z-debug-0.log
× Package install failed, see above.
The Schematic workflow failed. See above.
This scenario sounds like you may have a slow internet connection.
I solved my this error like SS
in the following way:
Try increasing the timeout from 60s to 90s by adding this to your .npmrc file:
You need create .npmrc file if you do not have it
C:\Users{username}.npmrc (for Windows)
~/.npmrc (for Linux/Mac)
timeout=60000
And you could also try adding if you have a slow internet connection or want to save bandwidth
prefer-offline=true
Or you can create/update one in the same directory as the project's package.json file as well.

error showing for angular cli installation

I am trying to install angular cli but it showing error .
the error is
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/#angular%2fcli failed, reason: getaddrinfo ENOTFOUND proxy.comviva.com proxy.comviva.com:8080
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\malaya.choudhury\AppData\Roaming\npm-cache\_logs\2018-12-03T07_09_20_267Z-debug.log
Please give me the solution.
Working answer from an already asked question:
In most cases you are behind a proxy or have bad network settings. First, run npm config list and check whether you are behind a proxy. If so, try running
npm config delete proxy
npm config delete http-proxy
npm config delete https-proxy
Link: https://stackoverflow.com/a/54512973/15291281

Resources