Questions & Answers

npm ERR! code ERR_SOCKET_TIMEOUT on creating new project using ng new appname

Can somebody help me on this? i am getting following error:

Angular & Node version Installed

Angular CLI: 12.0.1
Node: 14.16.0
Package Manager: npm 7.11.2
OS: win32 x64
    D:\Learning\Angular>ng new working
    ? Would you like to add Angular routing? No
    ? Which stylesheet format would you like to use? CSS
    CREATE working/angular.json (3045 bytes)
    CREATE working/package.json (1069 bytes)
    CREATE working/ (997 bytes)
    CREATE working/tsconfig.json (783 bytes)
    CREATE working/.editorconfig (274 bytes)
    CREATE working/.gitignore (604 bytes)
    CREATE working/.browserslistrc (703 bytes)
    CREATE working/karma.conf.js (1424 bytes)
    CREATE working/ (287 bytes)
    CREATE working/tsconfig.spec.json (333 bytes)
    CREATE working/src/favicon.ico (948 bytes)
    CREATE working/src/index.html (293 bytes)
    CREATE working/src/main.ts (372 bytes)
    CREATE working/src/polyfills.ts (2820 bytes)
    CREATE working/src/styles.css (80 bytes)
    CREATE working/src/test.ts (743 bytes)
    CREATE working/src/assets/.gitkeep (0 bytes)
    CREATE working/src/environments/ (51 bytes)
    CREATE working/src/environments/environment.ts (658 bytes)
    CREATE working/src/app/app.module.ts (314 bytes)
    CREATE working/src/app/app.component.html (23777 bytes)
    CREATE working/src/app/app.component.spec.ts (943 bytes)
    CREATE working/src/app/app.component.ts (211 bytes)
    CREATE working/src/app/app.component.css (0 bytes)
    / Installing packages (npm)...npm WARN deprecated urix@0.1.0: Please see
    npm WARN deprecated har-validator@5.1.5: this library is no longer supported
    npm WARN deprecated resolve-url@0.2.1:
    npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
    npm WARN deprecated request@2.88.2: request has been deprecated, see
    npm ERR! request to failed, reason: Socket timeout

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\username\AppData\Local\npm-cache\_logs\2021-05-23T07_57_24_639Z-debug.log
    × Package install failed, see above.
    The Schematic workflow failed. See above.
2023-01-22 01:42:02
timeout issues may occur due to connectivity issue. Make sure you've an active internet connection with a decent speed
Answers(20) :

Have you tried this :

- npm config rm proxy
- npm config rm https-proxy

Solve the error for me.


2023-01-22 01:42:02
Thank you very much! this worked for me. I have been on this error for more than a week, and I have been getting different errors every time I tried a different solution.

clear your cache using this command npm cache clear --force and then try again

2023-01-22 01:42:03
as a reference you can use this solution too
2023-01-22 01:42:03
can you explain how can this resolve a Socket timeout issue ?

if u re on ubuntu disable network proxy in network settings

Your command cannot succeed, because npm fails to fetch some module due to internet connection problems. You can try using different internet connection or increasing npm fetch timeouts.

I just had this issue and it helped changing timeouts:

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

You can find default values running:

npm config ls -l
2023-01-22 01:42:03
This worked for me but my internet is slow so I had to increase the durations to 2000000 and 12000000 respectively.
2023-01-22 01:42:03
The maxtimeout value 2000000 and 12000000 resolved.
2023-01-22 01:42:03
I've been trying for hours to change my DNS/proxy settings, and these two commands save me. Thanks!
2023-01-22 01:42:03
npm config ls -l | grep timeout on linux to go straight to the meaningful config tags
2023-01-22 01:42:03
I also had to add npm config set fetch-timeout 300000 for it to fully work. Thank you for the help.
2023-01-22 01:42:03
This worked for me; I specified exact values.
2023-01-22 01:42:03
yes, this worked for me as well. Slow Internet speed is most likely the culprit . Adding these values solved the problem

The registry URL is pointing to 'https'. There are chances you might be using a proxy that is blocking secure connections

Run npm config set registry="" and then try creating the app.

The command npm get registry shows the current URL it is pointing to.

I tried everything but this work for me: What I did is that I uninstall the node 16 and degrade it to node 14. Then in my command line I typed this code npm set timeout=100000

2023-01-22 01:42:03
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review

Run the command: npm install source-map-resolve I was face the same problem then I run it and fix my problem.

2023-01-22 01:42:03
If possible, could you add a little more info as to what this would do and how it would help address the problem? Thanks!
2023-01-22 01:42:03
While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value.
2023-01-22 01:42:03
That package is deprecated (source).

It works for Windows:-

npm config delete proxy
npm config delete https-proxy
2023-01-22 01:42:03
It works for me in Windows 11, I don't know what happens in Windows.
2023-01-22 01:42:03
also I had private dns ( on. turning it off helped

If you are using windows, ensure you try running using administrator command prompt

2023-01-22 01:42:03
This worked for me well, I tried to clean cache, tried to delete proxy as well, but only this worked. Thank you

Quick fix for error:0308010C:digital envelope routines::unsupported Version 18 and above of NODE for NUXT

The quick fix by adding this command in terminal


export NODE_OPTIONS=--openssl-legacy-provider


set NODE_OPTIONS=--openssl-legacy-provider

Pls close and reopen your command shell after you just installed node js library. That's worked well for me.

2023-01-22 01:42:03
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

This commands worked for me:

 npm config set registry
 npm install -d

Try this one

npm config set registry

set NPM config like this use http: instead of https:

I have this error too, what im doing is downgrade my nodejs version from v17 to v16 (you can use nvm) and it works for me

according to my experience better to use,

npm config set fetch-retry-mintimeout 200000
npm config set fetch-retry-maxtimeout 1200000

insted of "npm config set fetch-retry-mintimeout 20000" & "npm config set fetch-retry-maxtimeout 120000". Because this didn't work for me.

1st step:
npm install webpack webpack-cli --global
2nd step:
npm install rxjs
3rd step:
npm install webpack webpack-cli --global
4th step:
npm install -g
5th step:
npm install source-map-resolve
6th step:
npm config set registry

[1-3] perform for react
if you are facing this problem for angular perform [1-6]

I had the same error. The solution was to change the definition of the timeout.

It worked for me like a charm ✨

For changing the timeout, Run these two commands:

npm config set fetch-retry-mintimeout 20000

npm config set fetch-retry-maxtimeout 120000

I hope this helps.

  • npm config rm proxy
  • npm config rm https-proxy

then, reinstall react-app. Works for me on Macbook Pro (Intel).

I had the same error but I just opened up vscode on admin and it worked like a charm

2023-01-22 01:42:04
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

just with one line you can fix it ,it's worked with me :

config set fetch-retry-maxtimeout 120000000

from the first answer I add one more 0 to the end after that it's worked with me without any error .