17

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/README.md (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/tsconfig.app.json (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/environment.prod.ts (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     https://github.com/lydell/urix#deprecated
    npm WARN deprecated har-validator@5.1.5: this library is no longer supported
    npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
    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         https://github.com/request/request/issues/3142
    npm ERR! code ERR_SOCKET_TIMEOUT
    npm ERR! errno ERR_SOCKET_TIMEOUT
    npm ERR! request to https://registry.npmjs.org/@angular/cli/-/cli-12.0.1.tgz 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.
HDJEMAI
  • 8,842
  • 44
  • 66
  • 88
Mehran Khan
  • 487
  • 1
  • 3
  • 9
  • timeout issues may occur due to connectivity issue. Make sure you've an active internet connection with a decent speed – Sagar V May 23 '21 at 08:28

11 Answers11

28

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
17

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

ram
  • 372
  • 1
  • 10
14

Have you tried this :

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

Solve the error for me.

Regards,

  • 1
    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. – Othman Shawgan Mar 22 '22 at 09:30
5

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="http://registry.npmjs.org/" and then try creating the app.

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

ram
  • 372
  • 1
  • 10
5

It works for Windows:-

npm config delete proxy
npm config delete https-proxy
Syscall
  • 18,131
  • 10
  • 32
  • 49
Riyadh Ahmed
  • 51
  • 1
  • 3
3

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

  • 1
    If possible, could you add a little more info as to what this would do and how it would help address the problem? Thanks! – tklives Jan 18 '22 at 15:03
  • 1
    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. – CascadiaJS Jan 18 '22 at 22:53
  • That package is deprecated ([source](https://www.npmjs.com/package/source-map-resolve)). – Jeremy Caney Jan 19 '22 at 01:26
1

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

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/30642713) – CodeChanger Dec 24 '21 at 07:04
1

if u re on ubuntu disable network proxy in network settings

1

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

Alfi
  • 121
  • 2
  • 12
0

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

0

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

Alex Kim
  • 1
  • 1
  • 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](/help/how-to-answer). – Community Apr 14 '22 at 15:52