This timeout error occurs when npm cannot connect to the registry within the configured timeout period. It typically happens during Create React App installation due to network connectivity issues, proxy configurations, or firewall restrictions.
The ETIMEDOUT error indicates that npm's request to the package registry (registry.npmjs.org) exceeded the timeout threshold before receiving a response. This is a network-level error, not a problem with npm itself or the packages you're trying to install. When you run `npx create-react-app` or `npm install`, npm needs to download package metadata and files from the registry. If the connection is slow, blocked, or misconfigured, the request times out (default: 30 seconds). This is especially common in corporate networks with proxies, regions with slow connectivity to Cloudflare's CDN (which hosts the npm registry), or when firewall rules block registry access. The error doesn't mean the registry is downβit means your machine couldn't establish or maintain a connection within the allotted time.
First, try increasing the timeout to give npm more time to connect:
npm config set fetch-timeout 60000
npm config set fetch-retry-mintimeout 20000
npm config set fetch-retry-maxtimeout 120000Then retry your installation:
npx create-react-app my-appThis gives npm up to 60 seconds for initial connections and up to 120 seconds for retries.
Corrupted cache entries can cause timeout issues. Clear the cache and try again:
npm cache clean --force
npx create-react-app my-appThis removes all cached packages and forces npm to download fresh copies.
If you're behind a corporate proxy, check if npm has correct proxy configuration:
# Check current proxy settings
npm config get proxy
npm config get https-proxy
# Set proxy (replace with your actual proxy URL and port)
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
# If proxy requires authentication
npm config set proxy http://username:[email protected]:8080
npm config set https-proxy http://username:[email protected]:8080If you're NOT behind a proxy but these settings exist, remove them:
npm config delete proxy
npm config delete https-proxyContact your IT team to verify the proxy URL and confirm registry.npmjs.org is not blocked.
Ensure you're using the secure HTTPS registry URL:
npm config set registry https://registry.npmjs.org/Some networks handle HTTPS connections differently than HTTP, and the npm registry requires HTTPS for security.
IPv6 connectivity issues can cause timeouts. Force npm to use IPv4:
npm config set ipv6 falseThen retry your installation. This prevents npm from attempting IPv6 connections that may fail or timeout.
Verify you can reach the npm registry directly:
# Test DNS resolution and connectivity
ping registry.npmjs.org
# Test HTTPS connection
curl -I https://registry.npmjs.org/If these commands fail or are very slow, the issue is with your network connection to the registry. Contact your network administrator or try a different network (mobile hotspot, home network, etc.).
As a temporary workaround, you can use a registry mirror closer to your location:
# Example: Use npmmirror in China
npm config set registry https://registry.npmmirror.com/
# Or use Yarn as an alternative package manager
npm install -g yarn
yarn create react-app my-appNote: Only use trusted registry mirrors. After successful installation, you can switch back to the official registry.
Corporate Network Considerations: Many enterprises use SSL inspection (man-in-the-middle proxies) that can interfere with npm's HTTPS connections. You may need to configure npm to use your company's CA certificate:
npm config set cafile /path/to/company-ca-cert.pem
npm config set strict-ssl false # Only as last resort, security riskNetwork Configuration Files: npm reads configuration from multiple locations in this order: per-project (.npmrc in project root), per-user (~/.npmrc), global (/etc/npmrc). Check all locations for conflicting settings:
npm config listDiagnostics Logging: Enable verbose logging to see exactly where the timeout occurs:
npm install --verbose
# or
npm install --loglevel sillyRetry Configuration: npm automatically retries failed requests. You can adjust retry behavior:
npm config set fetch-retries 5
npm config set fetch-retry-factor 10This retries 5 times with exponentially increasing delays (factor of 10).
Using .npmrc File: Instead of using npm config set, you can create a .npmrc file in your project or home directory:
# .npmrc
fetch-timeout=60000
fetch-retry-mintimeout=20000
fetch-retry-maxtimeout=120000
registry=https://registry.npmjs.org/Cloudflare Issues: The npm registry is hosted on Cloudflare's CDN. Occasionally, specific regions experience routing issues. Using a VPN to connect from a different region can work around this, though it's rarely necessary.
React Hook useCallback has a missing dependency: 'variable'. Either include it or remove the dependency array react-hooks/exhaustive-deps
React Hook useCallback has a missing dependency
Cannot use private fields in class components without TS support
Cannot use private fields in class components without TS support
Cannot destructure property 'xxx' of 'undefined'
Cannot destructure property of undefined when accessing props
useNavigate() may be used only in the context of a <Router> component.
useNavigate() may be used only in the context of a Router component
Cannot find module or its corresponding type declarations
How to fix "Cannot find module or type declarations" in Vite