22

I have Successfully Install the Magento2 But when I try to run Homepage I getting below Errors in the console. enter image description here

Then I have checked in Magento git Ripo https://github.com/magento/magento2/tree/master/pub/static

I have found the below Image All Folders are missing.

If some has that folders then please provide us... enter image description here

  • Y down vote. the directory are missing if you have data then please provide me – Keyul Shah Dec 19 '14 at 13:43
  • My concern is that Magento2 git repo is not up to date. – Keyul Shah Dec 19 '14 at 13:43
  • 1
    I'm curious about the downvotes also. This is a legit question. Here is a +1 to compensate. I will provide a possible solution in a few minutes. – Marius Dec 19 '14 at 13:45
  • I think other users are not read the whole question and don't understand what I have try to said – Keyul Shah Dec 19 '14 at 13:47
  • 1
    @KeyulShah - look on the plus side, the down vote enabled you to get that hat :D I will also +1 to compensate. – Moose Dec 19 '14 at 13:55
20

The repo is up to date.
Here is how the resources in pub/static should work.
The meaning of "module" changed in magento 2. Now the files are not separated between code, template and skin. Everything goes in the same module Vendor_Module.

When requesting a resource from pub/static, if the file does not exist the request is rewritten to ../static.php?resource={resource name here}.
Take a look at the .htaccess file in the pub/static folder to understand better.

You get 404 responses probably because you don't have mod_rewrite enabled.
You should enable it.
But it can work without it.
There is a 'cache' system for these static resources.
navigate to the folder dev/tools/Magento/Tools/View and run this in the command line

php deploy.php

[EDIT]
In the later versions there is no more dev/tools/Magento/Tools/View folder.
You can get the same effect by running this command:

php bin/magento setup:static-content:deploy

[/EDIT]

This will copy the static resources from each module to the pub/static folder.
Be patient, it will take a while.
Remember this for the future. It is recommended to do this on the live server. It will speed up the access to static resources.

But there is a catch.

If you modify one of the static resources inside a module, the changes will not be available until you run php deploy.php again.
And you should never modify any file from pub/static directly. The changes will be overwritten the next time your execute deploy.php.

| improve this answer | |
  • After Enabling rewrite_module It will working Nice :) – Keyul Shah Dec 19 '14 at 14:22
  • running deploy.php from command prompt did the job, thanks again – stevensagaar Apr 16 '15 at 10:11
  • @marius, mod_rewrite enabled in my system and pub/static folder does not contain css and js also View folder does not exits indev/tools/Magento/Tools/ .Then please please tell why css and js not show 404 – Amit Bera Jun 29 '15 at 11:31
  • 1
    @AmitBera. This was an old answer. In the mean time the way the static files are deployed has changed. See my edit. – Marius Jun 29 '15 at 11:45
  • Nice explaination @Marius.it Works Thanks again. – Amit Bera Jun 29 '15 at 11:52
0

I have the same problem
Go to Magento root path xampp/htdocs/project
and run this command php bin/magento setup:static-content:deploy

| improve this answer | |

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.