0

These are the steps I used to deploy content:

  1. rm -rf var/di/* var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*

  2. sudo chmod 777 -R var pub pub/media app/etc

  3. php bin/magento setup:static-content:deploy

  4. php bin/magento cache:clean

But when I load the local site, there is no pub/media/styles.css file. Could anyone help me to fix this?

Error screenshot

  • sudo chmod 777 -R var & check – Ankit Shah Jan 5 '17 at 3:57
  • I did this. Please look at step 2 I posted above. That command includes var as well. – Tyler Bean Jan 5 '17 at 4:39
1

You also need to run setup:di:compile and then give permission 777 (Which is not preferable on production mode).

Run all the commands in below sequence :

  1. rm -rf var/di/* var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*

  2. php bin/magento setup:di:compile run this command. It will generate var/generation and other directories again.

  3. sudo chmod 777 -R var pub pub/media app/etc (Give permissions to generated directories)

  4. php bin/magento setup:static-content:deploy
  5. php bin/magento cache:clean

Refer this link for more details - After installation, I have problems with Magento 2

It will resolved your issue.

0

In your Magento pub /static folder .htaccess file chnge so copy that in another folder and paste it It is working for you

0

You have deleted your .htaccess file from pub/static/.htaccess

please unhide files on that folder if check if available, else copy it from another magento setup and copy - paste it on "pub/static/ HERE "

then follow below commands.

  1. sudo chmod 777 -R var pub pub/media app/etc
  2. php bin/magento setup:static-content:deploy
  3. php bin/magento cache:clean

Hope this will help you.

  • I checked and the .htaccess is still available on pub/static. I think it's not the problem. I downloaded zipped magento and copy the pub/media/styles.css from there to my project and it's working now. It's really hard to explain why the file is not created. – Tyler Bean Jan 5 '17 at 7:33
  • Great to hear your problem solved... :) @TylerBean – Yogesh Jan 5 '17 at 8:11
  • Thanks a lot. But it's still a mystery why the file is not created. :) – Tyler Bean Jan 5 '17 at 8:56

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.