A JavaScript file that still fails after deployment usually points to one of two problems: the page requests a URL that the deployment does not serve, or a cache or service worker is returning an old response. Start by checking the exact script URL and response in your browser’s Network panel, then compare that request with the files and paths actually deployed.
What a 404 tells you—and what it doesn’t
A 404 Not Found means the server responding to the request could not find the requested resource. It does not, by itself, explain why: the file may be absent, the URL may be wrong, routing may be misconfigured, or a cache may be serving a response associated with that URL.
That distinction matters because deploying a new JavaScript file does not help if the page still requests a different filename or path. The request URL—not the filename you expected to publish—is the starting point for diagnosis.
Trace the request from the browser to the deployed file
- Find the failing request. Open the browser’s developer tools, select the Network panel, reload the affected page, and click the JavaScript request that fails. Record its full URL, status, response body, and any indication of whether the response came from the network, browser cache, or a service worker.
- Compare the URL with the deployment. Check the requested path and filename against the files produced by your build and the files present in the deployed artifact. Include the build hash, capitalization, base path, and any deployment prefix in the comparison. Also verify that the host’s static-file mapping or routing serves that location.
- Check whether the page points to the current bundle. Inspect the HTML or runtime manifest that supplies the script URL. If the new build created a differently named bundle but the deployed HTML still references an older name, the browser will keep requesting the old URL.
- Inspect the response headers. Look for
Cache-Control,Age,ETag, andLast-Modified. These can help show whether a response is fresh, old, or being validated with the origin. A missingCache-Controlheader does not necessarily mean a response is never cached; caches may apply heuristic freshness rules. See MDN’s HTTP caching guide. - Check for a controlling service worker. In browser developer tools, inspect whether a service worker controls the page, then review its fetch handler and Cache API entries. Check how it installs, activates, removes older caches, and updates stored responses. A service worker can intercept page and script requests and choose to serve a cached response or go to the network; a normal reload may not bypass its behavior. See MDN’s Service Worker API and Cache API.
Match the fix to the layer that is wrong
| What you find | Likely issue | What to change |
|---|---|---|
| The requested path or filename does not match a deployed file | Wrong asset reference, missing build output, incorrect deployment path, or static-file routing | Correct the build or deployment mapping, or update the HTML/runtime manifest to reference the file that exists. |
| The deployed HTML still references an old bundle name | The entry document or manifest was not updated or is itself being reused from cache | Publish HTML that references the new asset URL and configure the HTML document to revalidate so clients can discover current asset names. |
| The URL is correct, but a cache returns an old response | Browser or managed HTTP cache freshness or validation behavior | Check the actual cache policy and, for a managed cache, use its documented purge or invalidation controls when needed. HTTP cache directives do not universally delete already stored responses. |
| A service worker controls the page and serves an old or missing response | Worker fetch logic or cache lifecycle | Update the worker’s cache version or strategy and remove obsolete entries during activation where appropriate. Verify the updated worker takes control and that its fetch logic reaches the current asset. |
HTTP caches reuse responses according to freshness and validation rules; a stale response may be checked with the origin using conditional requests. Those rules are separate from a service worker’s own Cache API logic and from a hosting provider’s cache-purge controls. Treat these as distinct layers rather than assuming one “clear cache” action covers them all.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
Why a deployment may not replace a cached response
Caches associate a response with a URL. If an asset’s URL stays the same, different layers may continue to reuse the response they already stored until their rules call for revalidation or replacement. Conversely, publishing a new asset under a new name does not make a page request it automatically: the HTML or runtime manifest must point to that new URL.
MDN recommends cache busting for changing static content by including a version or content hash in the asset URL. A common deployment pattern is to give versioned assets long freshness lifetimes while allowing the main HTML document to revalidate and discover the current asset names. Avoid overwriting an asset at a supposedly immutable URL and expecting every cache to infer that its contents changed. MDN’s HTTP caching guide explains cache keys, freshness, and cache busting.
Rank #2
Changing cache headers is not the same as deleting every copy that may already exist. MDN notes: “The HTTP Caching specification essentially does not define a way to explicitly delete a cache.” Managed caches may provide separate purge controls, while a service worker can remove entries through application code.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.How to prevent the same mismatch on the next deployment
- Publish hashed or versioned asset URLs when bundle contents change, and make sure the deployed HTML or manifest references the new names.
- Set cache lifetimes deliberately: versioned assets can be long-lived, while the entry HTML should be able to revalidate and reveal the current asset URLs.
- Keep deployment output, static-file routing, and any base-path configuration aligned so the URL generated by the build maps to the file served by the host.
- For service-worker apps, review the worker’s fetch strategy and activation cleanup whenever the asset naming or cache policy changes. MDN describes common approaches in its caching guide.
Without the failing request URL, response headers, deployed file list, hosting or CDN configuration, and service-worker code, it is not possible to identify which layer is responsible on a particular site. The request trace above separates those possibilities so you can make a targeted fix instead of repeatedly redeploying or clearing unrelated caches.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

