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

13,228

Solution 1

Static files has not been deploy , try

php bin/magento setup:static-content:deploy -f de_DE // or your language code

Also keep dev mode on it will show errors

php bin/magento deploy:mode:set developer

If still you have same issues run the following commands

rm -rf var  generated pub/static  
mkdir var generated pub/static
chmod 777 -R var generated pub

and then again

php bin/magento setup:static-content:deploy -f
php bin/magento deploy:mode:set developer

Solution 2

It seems you may be missing an important .htaccess file located in pub/static, make sure it is there. If not copy the one from GitHub Magento repo - https://github.com/magento/magento2

If you're not missing the file then it must be an issue with mod rewrite, make sure you've installed it and it is configured properly.

Solution 3

Try the two magento mode production / developer

bin/magento deploy:mode:set {mode} [developer|production]

Check also the owner of all your folders, I think your magento can't create static files.

Solution 4

<-- Changes in app\code\Magento\Developer\etc\di.xml -->

 Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink  

    -- to --

 Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

First please delete 'static' folder from 'pub/static' in magento 2 before delete this folder please copy .htaccess file from this folder in other folder in your pc. After that using cmd/shell run these commands

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

and

php bin/magento deploy:mode:set developer

and

php bin/magento cache:clean

after runing these commands .Paste old .htaccess file into new static folder. Thats it.

Your project working now enjoy!

Share:
13,228
CodeJam
Author by

CodeJam

Updated on June 09, 2022

Comments

  • CodeJam
    CodeJam almost 2 years

    im new in Magento 2, and i already getting annoyed with it, i made a fresh installation, and in the browser setup all looks ok, after successfully instalation on frontend and backend im getting a error, i cant login on the administration panel, when i load the admin page is giving me this error:

    Refused to execute script from '<URL>' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
    

    I checked online and many of the comments stated that was missing htacess, in pub/static, but everything is fine, i already clean cache, compile, deploy, etc.. I did it all, but cant understand why still i get the error...

    enter image description here

    Frontend Error: enter image description here

    Note: The strange thing im checking in the console error of the frontend is the error line

    http://mageuniversity.local/Magento_Theme/js/responsive.js net::ERR_ABORTED 404 (Not Found)
    

    I dont understand how the hell is looking in the root path the "Magento_Theme/js.." have no idea.

  • Sandeep Sudhakaran
    Sandeep Sudhakaran almost 5 years
    Tried this. still facing issue.
  • Sandeep Sudhakaran
    Sandeep Sudhakaran almost 5 years
    tried both developer and production mode. still facing this issue.
  • Dexture
    Dexture almost 5 years
    Run these commands rm -rf var generated pub/static mkdir var generated pub/static chmod 777 -R var generated pub
  • AboElnouR
    AboElnouR over 4 years
    It's not working fine and stopped my website with 500
  • JerodG
    JerodG about 4 years
    If you could add some clarity to this it would be more beneficial.
  • Narwal Saab
    Narwal Saab about 4 years
    Thanks for comment for more clarity in this.