1

Disclaimer: I'm new to Magento 2 development as of Nov 2018, and new to development generally as of mid-2017. So I'm new to asking development-help questions too. Most of the time I can figure it out on my own. Please forgive me for anything I do that is something I should know not to do.

My problem: All styling is gone from my frontend (admin is fine).

When the problem started: When I was trying to add a custom font via an '_extend.less' file. (Creating this file and using it to make changes was the method that was being used in a tutorial I was following to make custom styling changes.)

(I have Magento set to Developer Mode.)

I have set everything back to the way it was before trying to add the custom font (as best I can tell), but the problem still remains. Around the time I was trying to add the custom font, I remember using the command cache:disable, and maybe this messed something up? I've since used cache:enable, but the CLI responds with There is nothing to change in cache status.

I have searched online over the course of 3 days for a total of around 10 hours for a solution. Just so you know I've really tried to figure this out on my own, the following are some things I have tried many (many!) times, and in many variations as to their order and combination (I'm pretty sure new developers do this a lot!):

  • indexer:reindex
  • cache:clean
  • setup:upgrade
  • setup:static-content:deploy -f
  • deploy:mode:set production

    (The idea here was apparently setting it to Production Mode would clear things in a certain way, and then I was supposed to set it back to Developer Mode, and this would fix the problem. But I get an error part way through setting it to Production Mode when it tries to deploy static content, and it shows a message in bright red: Command returned non-zero exit code. Plus above that there's a line that reads: Something went wrong while deploying static content. See the error log for details. Is the error file it's talking about in 'var > log'? Because all the files in there have a 'Date modified' showing 8 days ago, which is way before this problem started. What log file is this referring to?)

  • using the 'Flush Static Files Cache' button (In Admin: System > Cache Management)

  • using the 'Flush JavaScript/CSS Cache' button (In Admin: System > Cache Management)
  • using the bright orange 'Flush Magento Cache' button (In Admin: System > Cache Management)
  • setting directory and file permissions (pretty much to 777 every time)
  • rm -rf view_preprocessed/*
  • rm -rf static/*
  • rm -rf var/{cache,di,generation,page_cache,view_preprocessed}
  • and I couldn't begin to tell you how many times I've hit 'Shift+F5' to refresh the storefront page

'No styling' seems like such a simple issue, but I can't figure this one out. Any help would be greatly appreciated!

I'm on Apache, all served from Google Cloud Platform (static IP), Bitnami stack.

Edit: screenshots added

browser view - no styling issue

console view - no styling issue

2
  • Hi, please attach a screenshot of the front end with console logs. Are you on Apache or Nginx? Commented Dec 2, 2018 at 3:07
  • Kudos for a well written and well researched question...
    – Haim
    Commented Dec 2, 2018 at 5:48

3 Answers 3

1

Please check in your frontend store language. If frontend store language is different then you need to setup:static-content:deploy -f {lanug_code}.

Like, If your frontend store in Germany then run below command.

setup:upgrade
setup:static-content:deploy -f de_DE en_US
cache:clean
Give full permission to var/ and pub/ folder

de_DE use for frontend store and en_US for backend side.

I hope so it's work for you.

1
  • Thanks for the suggestion. I'm using 'en_US' only. I've never enabled any other languages.
    – devbiker
    Commented Dec 2, 2018 at 19:13
0

Check followings (Suppose you are in developer mode),

To troubleshoot the static content deployment issue

  • Try to compile blank theme. php bin/magento setup:static-content:deploy -t Magento/blank
2
  • .htaccess is present (permissions are 777), and has the same content as the one you linked to... apart from something about 'moxieplayer' in the linked one which I've ignored. I tried to delete caches as you suggested, but get 'Permission denied' for all files even though permissions are 777 recursively. I used sudo /opt/bitnami/ctlscript.sh restart for both apache and varnish. I get varnish started at port 80 and httpd started at port 81(apache). Should the ports match? Compiled blank theme... still getting ''static content' error. In httpd.conf, changed AllowOverride to All from None
    – devbiker
    Commented Dec 2, 2018 at 19:51
  • Seems you have a file permission issue. Try running static content deploy as root user. sudo php bin/magento setup:static-content:deploy -t Magento/blank The ports shouldn't be the same. Hope you have updated the varnish vcl. Commented Dec 3, 2018 at 16:53
0

Well, I came up with a solution: start a new custom theme.

No, that's not the solution I was hoping for. But sometimes the best thing to do is abandon something if it's not working and start over. In my case, fortunately, I wasn't too far along with the first theme, and it didn't take long to get back to where I left off. So I can confirm everything behind the scenes is still working fine. There's just something with what I was doing before that broke, and I couldn't fix it. I don't like that, because if whatever caused the problem happens again, I'm right back at the same place again. I really don't want a recurring solution of 'start over' every time. But I feel I spent enough time trying to figure it out, so let's just move forward, and cross that [broken] bridge if we come to it again.

Thanks to everyone for taking your time to try to help.

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.