1

In Magento 2 after clearing all files:

Remove pub/static
Remove var/cache
Remove var/composer_home
Remove var/generation
Remove var/page_cache
Remove var/view_preprocessed

when enabling developer mode. why its still try to load files from pub/static?

and even if files are in pub/static but when i am trying to open a css file its showing 500 error. But same file is accessible in production mode. Even in development mode when i am changing anything in phtml file under theme why its does not updated in developer mode ?

1 Answer 1

1

@user3443146 For some general background information about how Magento 2 serves front-end assets, check out Alan Storm's excellent article: http://alanstorm.com/magento-2-frontend-files-serving/. I'd encourage you to check out all his his articles that relate to the type of Magento 2 work you're doing.

Next, relating to developer mode: In this mode, Magento 2 will try to generate the various types of code that this system generates, and it does so on each page request. There's a lot of action going on regarding code generation and code symlinks, which go beyond a simple answer. That said, Magento 2 will always be looking in pub/static for static content, that's just how the system works. If it has already transpiled any Less files into css files, it won't try to transpile them again (unless you manually delete them, or clear the static cache in the admin panel, or use grunt, etc, etc).

production mode: In this mode, Magento 2 does not try to generate the various files that this system generates on each page request. Instead, in production mode, you're engaging the cli to do all the static content generation at one time, and then the resulting files are stored in pub/static. So this mode is mainly meant to be used as you're setting up your site to be used in production (hence the name).

Finally, the 500 error: This class of error code is always a server-side error. You need to take a look at your server logs to see what the error details are. Or you can enable php error output, if the error is php related you'll see the output on the frontend. Most likely, based on my current work with M2, it's probably permissions/ownership related. Due to the fact that Magento 2 does set permissions/ownership on the content that it creates, the webserver might not be able to write to directories that Magento 2 created (this depends on how you've set up your permissions/ownership).

Check out this docs for suggestions on how to set your environment up:

pre-installation permissions/ownership

mode-specific permissions/ownership

2
  • 500 error : its show when trying to access a pub/static css file in developer mode. but same file is accessable in production mode. if it is permission issue same error should be visible in production mode. Commented Jan 6, 2017 at 10:18
  • Check your webserver error log to see what that error message is. Otherwise, you're trying to debug blind or guess.
    – ryanF
    Commented Jan 6, 2017 at 10:22

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.