Magento 2 MIME type ('text/html') is not executable, and strict MIME

Magento 2 MIME type ('text/html') is not executable, and strict MIME

July 11, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 2 MIME type ('text/html') is not executable, and strict MIME

Solving Magento 2 MIME Type Errors: A Comprehensive Guide

Welcome to our Magento development blog! Today, we’re going to tackle a common issue faced by new Magento 2 users - the dreaded MIME type error that prevents you from logging into your admin panel.

Understanding the Error Message

The error message you’re seeing:

Refused to execute script from 'http://mageuniversity.local' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Basically means that the browser is refusing to run JavaScript from your Magento store because it isn’t recognizing the correct MIME types.

Why You’re Seeing This Error

There are several reasons why you might be encountering this issue:

  1. Incorrect File Permissions: If the necessary files don’t have the correct permissions, the server won’t recognize them as executable scripts.

  2. Missing or Corrupted Files: Sometimes, during the installation process, certain files might not get copied over correctly, leading to missing dependencies.

  3. Caching Issues: Magento has a complex caching system that sometimes needs manual clearing to ensure all files are served correctly.

  4. Incorrect Base URL Configuration: If your base URLs aren’t configured properly in the admin panel (System -> Configuration -> General -> Web), it can cause this error.

Step-by-Step Resolution

Let’s go through each potential solution:

1. Check File Permissions

Ensure that your pub/static directory and all its contents have the correct permissions. They should be set to 755, allowing the server to execute them.

chmod -R 755 pub/static/

2. Re-upload Necessary Files

If certain files are missing or corrupted, try re-uploading them manually:

  • Download the pub/static folder from your Magento installation.
  • Delete the existing pub/static folder in your live environment (make sure to backup first!).
  • Upload the newly downloaded pub/static folder.

3. Clear Magento Cache

Sometimes, clearing the cache manually can resolve the issue:

php bin/magento cache:clean

Followed by:

php bin/magento cache:flush

Then deploy static content again:

php bin/magento setup:static-content:deploy -f

4. Check Base URL Configuration

Ensure that your base URLs in the admin panel match exactly with what you’re typing into your browser.

Go to System -> Configuration -> General -> Web, and ensure both the “Base URL” and “Secure Base URL” are configured correctly for your store view.

Additional Troubleshooting Steps

Let’s address some additional points:

  • JavaScript File Missing: The error in your frontend console suggests that a JavaScript file is missing. This could be due to the deployment of static content not running successfully or an issue with the theme configuration. Deploying static content again and double-checking your theme settings should resolve this.

  • Missing htaccess File: While many comments online suggest checking for an htaccess file, in a fresh installation, it’s supposed to be there by default. If it’s missing, re-upload it from your Magento installation package.

Conclusion

In most cases, the solutions outlined above should help you resolve this issue. Remember that Magento 2 is a complex platform with many moving parts, and sometimes multiple steps are necessary to ensure everything works correctly.

If you’re still having trouble after following these guidelines, consider reaching out to a professional Magento development team for further assistance. At Laravel Company, we specialize in Magento development services and can provide expert guidance tailored to your specific needs.

Happy coding!

Magento 2 Database Security Admin

Our network