3

I have successfully installed a fresh Magento 2 instance on my mac however none of the CSS is loading. Could someone advise of a fix?

The following folders dont exist /pub/static/frontend/ /pub/static/adminhtml/

However looking at the htaccess rules it seems they shouldnt as it gets routed to static.php is that correct?

9
  • 1
    You run bin/magento setup:static-content-deploy in directory install and reload page
    – LinoPham
    Commented Nov 25, 2015 at 14:46
  • If I try to run that it states -bash: bin/magento: Permission denied Then if I run find . -type d -exec chmod 770 {} \; && find . -type f -exec chmod 660 {} \; && chmod u+x bin/magento I get the following: chmod: bin/magento: No such file or directory
    – Goose84
    Commented Nov 25, 2015 at 15:00
  • Okay got it to run if I put in bin/magento setup:static-content:deploy note the : However the issue still remains even though the CSS file now exists
    – Goose84
    Commented Nov 25, 2015 at 15:14
  • could you please confirm what error you see in browsers console? and is it 404 or 403? have you tried to delete var/* and restart apache?
    – MagenX
    Commented Nov 25, 2015 at 15:22
  • 1
    if you have 403 then permissions are wrong. files must be owned by php user and readable by apache user.
    – MagenX
    Commented Nov 25, 2015 at 15:48

2 Answers 2

2

run command as owner of magento files from magento root folder:

bin/magento setup:static-content:deploy en_GB

if you run it as root you will have to change user:

su - {user}

or switch user and run command in one line:

su - {user} /usr/bin/php -c bin/magento en_GB

then run chown command so every file will be properly owned:

chown -R {user}:{group} *

if you get error from static files deployment , you will have to fix them, until you will get success message.

http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-static-view.html

2
  • Thanks for the reply but as per my comments above I have done this however its pulled the wrong locale for the css its pulling en_US and not en_GB. Any advice on how to fix would be great
    – Goose84
    Commented Nov 26, 2015 at 8:57
  • Did you ever work out why it is pulling en_US instead of GB - I am getting exactly the same issue
    – tim.baker
    Commented Jul 12, 2016 at 10:54
1

Deploy content by using the command:

php bin/magento setup:static-content:deploy

Then Set the writable permissions to var, pub/static and pub/media directories. you can use the command:

 chmod -R 777 var/ pub/static pub/media

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.