Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing packages (npm)...npm ERR! code ERR_SOCKET_TIMEOUT npm ERR! errno ERR_SOCKET_TIMEOUT #4553

Closed
2 tasks done
mbunix opened this issue Mar 11, 2022 · 33 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@mbunix
Copy link

mbunix commented Mar 11, 2022

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/postcss-import: 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! /home/bentex/.npm/_logs/2022-03-11T08_41_06_921Z-debug-0.log
✖ Package install failed, see above.
The Schematic workflow failed. See above.

Expected Behavior

I expect to create a new angular project using the command ng new but seems theres a socket timeout each time i try

Steps To Reproduce

  1. In this environment... linux distro parrotOs
  2. With this config...
  3. Run '...' ng new ..
  4. See error...

Environment

npm -v
8.3.1

$node -v
v17.4.0

"user" config from /home/bentex/.npmrc

legacy-peer-deps = true

; node bin location = /home/bentex/.nvm/versions/node/v17.4.0/bin/node

@mbunix mbunix added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Mar 11, 2022
@oonsamyi
Copy link

Same issue with npm 8.5.4

@mbunix
Copy link
Author

mbunix commented Mar 16, 2022

There's a problem with ng schematics npm parsing for v 8 > i dont't get it .

@donato95
Copy link

Having the same issue with react no solution seems to work...

@nlf
Copy link
Contributor

nlf commented Mar 17, 2022

closing as a duplicate of #3078

@ArmishMunir
Copy link

I just had this issue and it helped changing timeouts:

npm config set fetch-retry-mintimeout 20000
npm config set fetch-retry-maxtimeout 120000

@shahdhairya51
Copy link

I just had this issue and it helped changing timeouts:

npm config set fetch-retry-mintimeout 20000 npm config set fetch-retry-maxtimeout 120000

This works .thankyou

@mod7ex
Copy link

mod7ex commented Jun 28, 2022

none of the above worked for me is there any other way ? i have tried eveyrthing in stackoverflow also
is it an issue related to ubuntu ?

@mihir1739
Copy link

is it an issue related to ubuntu ?

No..I am facing same issue in arch linux.

@mod7ex
Copy link

mod7ex commented Jul 6, 2022

guys try this it helped many others

@mustafiz-rahman
Copy link

npm config set fetch-retry-maxtimeout 120000 npm config set fetch-retry-mintimeout 20000

This worked for me

@mrdcvlsc
Copy link

mrdcvlsc commented Jul 27, 2022

I have also encountered this error today with:

  • npm - 8.15.0
  • node - v18.6.0

I was trying out npx create-react-app for the first time, and this error keeps on occurring.

I just had this issue and it helped changing timeouts:

npm config set fetch-retry-mintimeout 20000 npm config set fetch-retry-maxtimeout 120000

This one helped me... though I need to add commands and modify the values.

This is what I did:

npm config set fetch-retries 5
npm config set fetch-retry-mintimeout 600000
npm config set fetch-retry-maxtimeout 1200000
npm config set fetch-timeout 1800000

Seems overkill but It worked for me.

@hijal
Copy link

hijal commented Jul 28, 2022

I just had this issue solved by upgrading the npm package 8.13.2 -> 8.15.1

@svdilshan
Copy link

My npm version is 8.15.1 but this error not fix .

@eyo25
Copy link

eyo25 commented Aug 4, 2022

thanks man it worked for me too

@mahbub75
Copy link

mahbub75 commented Sep 4, 2022

I just had this issue and it helped changing timeouts:

npm config set fetch-retry-mintimeout 20000 npm config set fetch-retry-maxtimeout 120000

it work for me. thanks

@ranaPhero
Copy link

v-8.5.0
Same issue with npm

@Noema-Zhao
Copy link

I have also encountered this error today with:

  • npm - 8.15.0
  • node - v18.6.0

I was trying out npx create-react-app for the first time, and this error keeps on occurring.

I just had this issue and it helped changing timeouts:
npm config set fetch-retry-mintimeout 20000 npm config set fetch-retry-maxtimeout 120000

This one helped me... though I need to add commands and modify the values.

This is what I did:

npm config set fetch-retries 5
npm config set fetch-retry-mintimeout 600000
npm config set fetch-retry-maxtimeout 1200000
npm config set fetch-timeout 1800000

Seems overkill but It worked for me.

It worked for me when I'm installing firebase, only set maxtimeout and timeout 10 times longer.

@alikhaleghifar
Copy link

it work for me. thanks

@LiuLiujie
Copy link

Meet this problem today in a job using Github Actions.

@HarshDeswal
Copy link

It worked for me. Thank you

@cverma61
Copy link

Had the same issue.
This command worked for me.
npm config set fetch-retry-maxtimeout 120000

@tohagan
Copy link

tohagan commented Mar 23, 2023

Same issue ... Turned out to be an issue with my local network connection that was slow.
I needed ...

$ npm config set fetch-retries 20

@reorx
Copy link

reorx commented Mar 29, 2023

What works for me is to set the wait time between retries to a smaller value:

npm config set fetch-retry-mintimeout 2000

by default its 20s, I think 2s is enough for me

@bzsky1
Copy link

bzsky1 commented Apr 18, 2023

I have also encountered this error today with:

  • npm - 8.15.0
  • node - v18.6.0

I was trying out npx create-react-app for the first time, and this error keeps on occurring.

I just had this issue and it helped changing timeouts:
npm config set fetch-retry-mintimeout 20000 npm config set fetch-retry-maxtimeout 120000

This one helped me... though I need to add commands and modify the values.
This is what I did:

npm config set fetch-retries 5
npm config set fetch-retry-mintimeout 600000
npm config set fetch-retry-maxtimeout 1200000
npm config set fetch-timeout 1800000

Seems overkill but It worked for me.

It worked for me when I'm installing firebase, only set maxtimeout and timeout 10 times longer.

ouuuuuuuuugh thanks, for me too works only this

@Mopro007
Copy link

Mopro007 commented May 1, 2023

Having the same issue with react no solution seems to work...

same here

@Mopro007
Copy link

Mopro007 commented May 1, 2023

I've been having this issue for 14 days !!!!!!!!
I tried every single solution I found here !
I tried every single solution I found on stackoverflow !!
I tried every single solution I found on google !!!
I tried every single solution I got from chatGPT !!!!

AND
NON
OF
THEM
F*CKING
WORKED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@bzsky1
Copy link

bzsky1 commented May 1, 2023

I've been having this issue for 14 days !!!!!!!! I tried every single solution I found here ! I tried every single solution I found on stackoverflow !! I tried every single solution I found on google !!! I tried every single solution I got from chatGPT !!!!

AND NON OF THEM F*CKING WORKED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

mmm try to add one or two more 0 for :

npm config set fetch-retry-maxtimeout 1200000
npm config set fetch-timeout 1800000

in my case it was bc slow internet i think, this problem appeared when i move in new apt with slow internet so was needed to made fetch timeout bigger

@dopatraman
Copy link

NB for 2023: None of these solutions work. I dont see how changing the max timeout will stop the timeout from happening. This seems to be an issue with the NPM registry.

@Ali-Aref
Copy link

Ali-Aref commented May 10, 2023

I just had this issue and it helped changing timeouts:

npm config set fetch-retry-mintimeout 20000
npm config set fetch-retry-maxtimeout 120000

Thanks man! this worked for me <3

@natainditama
Copy link

natainditama commented Jun 15, 2023

I just had this issue and it helped changing timeouts:

npm config set fetch-retry-mintimeout 20000 npm config set fetch-retry-maxtimeout 120000

Nice!!. thank you

@eyluldnz
Copy link

This worked for me, thanks ....

@reven-erlangga
Copy link

I just had this issue and it helped changing timeouts:

npm config set fetch-retry-mintimeout 20000 npm config set fetch-retry-maxtimeout 120000

Thanks bro, this worked for me....

@rexjoseph
Copy link

What works for me is to set the wait time between retries to a smaller value:

npm config set fetch-retry-mintimeout 2000

by default its 20s, I think 2s is enough for me

thanks. this works as of Nov. 1 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests