1

I have a fresh new intall of magento 2, which appeared to be working fine till I changed the Theme to Luma. Then the frontend styles disapeared, the info is there, as well as the products, but no styles at all, not even if chose blank theme or no theme at all. Backend is OK. What I have done so far:

  • Run again ./magento setup:static-content:deploy
  • Duble checked that Write Engine is ON
  • Cleared cache both in Magento admin and using command line
  • Reindexed via command line
  • Cleared browser cache
  • Set directories and files permisions to 755 and 644 respectively
  • Veryfied the exitence of .htaccess file in the pub/stactic directory
  • tried to recompile styles only

But just cannot get the styles to come back again.

3 Answers 3

2

Remove folders from Var directory (cache, generation and page_cache) then use following commands in CLI(from magento 2 root): - php bin/magento setup:di:compile - php bin/magento setup:static-content:deploy (for magento 2.2.x or more you have to use -f)

then refresh page and you will have all css applied.

2
  • From magento ver 2.2.x+ you have to use "php bin/magento setup:static-content:deploy -f" (note: -f)
    – TawabG
    Commented Dec 18, 2019 at 12:24
  • @TawabG from 2.2.x+ you don't need to run deployment command as whenever you run setup upgrade command it automatically deployed required filed, you just need to clear cache and if required then only need to run deployment command forcefully. Commented Dec 18, 2019 at 13:06
0

I had the same problem. The following trick did it. 1)Open Terminal. 2)cd to your root(your project folder) directory. 3)Remove the contents of the following folders as super user. 1) root/var/view_preprocessed/ 2) root/pub/static/

$ sudo rm -rf *(hit return)

When you were 'cd'-ed in both the locations. Don't worry about deleting the files. They are repopulated again with the newly active theme contents.

Now reload your store and view. Your problem should be solved by now.

P.S -> Only use the above command while you are in one of the above mentioned directories. Or-else you will inadvertently delete the contents of the folder you are in, '*' means everything. This is for the uninitiated.

2
  • 2
    Just a note, since not everyone here knows what they are doing, posting commands like sudo rm -rf * can be very dangerous. People not understanding what they are doing can do a lot of damage. It's better to post something like sudo rm -rf var/view_preprocessed/* so if someone where to copy and paste it not knowing what they are doing, it will just do nothing to their site.
    – circlesix
    Commented Feb 25, 2017 at 23:08
  • sudo rm -rf * what could go wrong - apart from deleting all your files Commented Dec 18, 2019 at 13:17
0

You have to do the below steps again:

  1. Remove blank and luma folder from magento2/pub/static/frontend/Magento/
  2. After Remove you have to apply command php bin/magento setup:static-content:deploy

Clear cache of admin and clear browser cache plus remove var folder from the root.

Check again It's working.

1
  • 1
    I had already done that, and did not help ...
    – baryte
    Commented Mar 21, 2016 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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