MIME type not executable 🟨 JavaScript

Refused to execute script from 'x' because its MIME type ('text/html') is not executable

The browser fetched a script but the server labelled it text/html (usually an error page), so it refused to run it.

Seen on: JavaScript

Meaning

With X-Content-Type-Options: nosniff, browsers enforce MIME types. A 404 HTML page or SPA fallback served at a .js URL triggers this.

Common causes

  • Script URL returns a 404/HTML page
  • SPA fallback serving index.html for missing assets
  • Server not mapping .js to application/javascript

⚡ Quick fix

  1. Open the script URL directly to see what’s returned
  2. Fix asset paths/base URL
  3. Configure correct MIME types

Detailed fix by platform

Nginx

  1. Make sure include mime.types; is present in the http block

How to diagnose

  1. Response — What does the script URL return?
  2. Type — Content-Type header

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.