0

The backend of my Magento installation is not loading CSS/JS. I have reached a point where I just cannot work out why this is happening and hoping that someone might have an idea.

This is what I am seeing:

enter image description here

I can also see that in pub/static/adminhtml/backend/en_US there is no css folder.

This is what I have tried to resolve this:

  • Confirmed .htaccess is present in the pub/static folder
  • In developer mode, I have ran the following commands:
bin/magento cache:clean
bin/magento cache:flush     
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
  • Set dev/static/sign to 0 directly in DB.

  • Built in production mode with:

bin/magento setup:upgrade
bin/magento deploy:mode:set production
  • Checked and reset all permissions
  • Checked var/log/ for any indications of errors - there is just this:
main.ERROR: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/css/styles.css' [] []
main.CRITICAL: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/css/styles.css' [] []
main.ERROR: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/js/theme.js' [] []
main.CRITICAL: Unable to resolve the source file for 'adminhtml/Magento/backend/en_US/js/theme.js' [] []

I have spent way too long searching for an answer on here, Google, etc. and it just seems to send me in circles with all suggestions being one of the above.

I am guessing it might be something simple, something I have overlooked but I am just not seeing it today. Any help will be appreciated.

  • Delete all folder in pub/static/ expect .htaccess. Run command: php bin/magento setup:static-content:deploy Good luck. – Ranjeet Kumar Oct 23 '19 at 12:04
  • @RanjeetKumar Yes, as I said, I have tried that. Running setup:upgrade empties that folder anyway. – Paul Blundell Oct 23 '19 at 12:25
0

Please try to run below commands

php bin/magento deploy:mode:set developer
rm -rf var/cache/* var/page_cache/* var/view_preprocessed/* generated/*
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
chmod -R 777 var/ pub/ generated/
php bin/magento cache:clean
php bin/magento cache:flush

After running above command please try to refresh your Backend. Make sure that URL Rewrite also enabled.

Hope this will help you!

| improve this answer | |
  • Yes I have ran all of those commands in that order more than once and same issue. Forgot to mention above, checking rewrite was enabled was one of the first things I tried. – Paul Blundell Oct 23 '19 at 12:26
  • Still you're not able to open backend ? – Kishan Savaliya Oct 23 '19 at 12:27
  • Nope. CSS is not being generated. Also, 777 on pub directory is an incredibly bad idea! – Paul Blundell Oct 23 '19 at 12:27
  • Can you please press CTRL + U in your browser and then check what is your locale there ? – Kishan Savaliya Oct 23 '19 at 12:28
  • Yeah thats en-US – Paul Blundell Oct 23 '19 at 12:32
0

So my issue seems to have been fixed now by completely removing the vendor folder and running:

composer install

I have no idea why this fixed the issue, I have never changed anything in that folder.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.