FG
💻 Software🛠️ Developer ToolsMicrosoft

Error Response timeout while trying to fetch http://registry.npmjs.org/@angular%2fcli (over 30000ms)

Fresh5 days ago
Mar 14, 20260 views
Confidence Score60%
60%

Problem

I want to install the angular cli using npm install @angular/cli but a got an error saying that it could not fetch the data. I have tried using both node js version 12 and 13 and also differents npm versions - I dont use a proxy server. - I dont use a vpn. - My internet connection does not have any problem. - I tried to uninstall node js, also erased the npm directory from Appdata and any other related directory to Node js this is the log file: 0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'install', 1 verbose cli '-g', 1 verbose cli '@angular/cli' 1 verbose cli ] 2 info using npm@6.14.4 3 info using node@v12.16.2 4 verbose npm-session b1b30f92d1295fda 5 silly install loadCurrentTree 6 silly install readGlobalPackageData 7 silly fetchPackageMetaData error for @angular/cli@latest Response timeout while trying to fetch http://registry.npmjs.org/@angular%2fcli (over 30000ms) 8 timing stage:rollbackFailedOptional Completed in 1ms 9 timing stage:runTopLevelLifecycles Completed in 30453ms 10 verbose type body-timeout 11 verbose stack FetchError: Response timeout while trying to fetch http://registry.npmjs.org/@angular%2fcli (over 30000ms) 11 verbose stack at Timeout._onTimeout (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:189:16) 11 verbose stack at listOnTimeout (internal

Error Output

error saying that it could not fetch the data.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Increase NPM Fetch Timeout and Clear Cache

Medium Risk

The error indicates that the npm client is unable to fetch the package metadata from the npm registry within the default timeout period of 30 seconds. This can occur due to network latency, issues with the npm registry, or local cache corruption.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Increase NPM Fetch Timeout

    Set the npm fetch timeout to a higher value to allow more time for the request to complete. This can help if the network is slow or the npm registry is experiencing delays.

    bash
    npm config set fetch-retries 5 && npm config set fetch-retry-mintimeout 20000 && npm config set fetch-retry-maxtimeout 120000
  2. 2

    Clear NPM Cache

    Clear the npm cache to remove any potentially corrupted files that might be causing the fetch to fail. This can help resolve issues related to stale or corrupted cache data.

    bash
    npm cache clean --force
  3. 3

    Check Network Configuration

    Verify that there are no firewall rules or security software blocking access to the npm registry. Temporarily disable any such software to test if it resolves the issue.

    N/A
    N/A
  4. 4

    Use a Different Registry

    If the issue persists, try switching to a different npm registry mirror to see if that resolves the timeout issue. You can use the Yarn registry or a local mirror.

    bash
    npm config set registry https://registry.yarnpkg.com
  5. 5

    Re-attempt Installation

    After performing the above steps, try to install the Angular CLI again to see if the issue has been resolved.

    bash
    npm install -g @angular/cli

Validation

To confirm the fix worked, check if the Angular CLI installs successfully without timing out. You can verify the installation by running 'ng --version' after the installation completes.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

npmpackage-managernodejsrelease-6.x