3

In developer mode I been getting the error

FileError: '/pub/static/frontend/theme/theme_name/en_GB/css/styles-m.css' wasn't found (404)

I've taken the following steps to try and resolve this:

Used Refresh static content in the cache management

Taken magento2 out of development mode, check if worked then back in development mode

Backup current static folder, removed contents inside and try to refresh.

All of these points still give me the error above

2
  • Just changed the theme to see if it's a issue in general but works if the blank theme, swapped back and the error appeared again.
    – lee murphy
    Commented Mar 31, 2016 at 11:11
  • Use php bin/magento setup:static-content:deploy command from command line it may resolve your problem
    – Aman Alam
    Commented Jun 19, 2016 at 6:36

4 Answers 4

2

You need to deploy static-content with Magento 2.

At the least, your hosting company should be able to run this command for you.

  1. Make sure that you set your Magento application to developer mode.
  2. Need SSH credentials & access to your server
  3. Login to server using SSH via terminal, putty, etc.
  4. Navigate to Magento 2 root install directory using CLI
  5. Run this command:

_

php bin/magento setup:static-content:deploy en_GB
4

I faced the same problem I had to explicitly add .htaccess file in pub/static then theme worked fine as it was missing.

2
  • thank you, that was a life saver!
    – zekia
    Commented Apr 17, 2019 at 11:43
  • it is really work Commented Apr 25, 2019 at 11:00
1

If using apache, and AllowOverride is not set, you will get static content errors as well. To enable AllowOverride for magento; add the following to your apache sites-enabled file:

<Directory "/path/to/magento/install">
    AllowOverride All
</Directory>
0

You need to deploy your static content files. this will create copies of your view files and compile the less files to css and move them to your /pub folder which is the only folder accessible via http.

The only way to do this is from the CLI. In SSH go to the bin folder in your document root and run the following command:

./magento setup:static-content:deploy en_EN

if you have different languages installed, add them like this:

./magento setup:static-content:deploy en_EN nl_NL de_DE enz..

After compilation the files should be there and the theme should load correctly.

4
  • 1
    Tired, this with the correct language code and still the same error
    – lee murphy
    Commented Mar 31, 2016 at 10:12
  • can you check if the following folder exists: www/pub/static/frontend/YOURTHEMENAME/theme/your_LANGUAGE. Do you get any errors while deploying? Commented Apr 1, 2016 at 8:00
  • Just a wild gues. but Is there a style-m.css file in your theme? if not, check if the theme.xml file in the root of your theme folder had a <parent> defined. if not, add the folowing line right below the <title></title> tag: <parent>Magento/luma</parent> and retry deploying Commented Apr 1, 2016 at 8:18
  • There is the folder and style-m.css in my theme and, I also have the magento blank defined as a parent
    – lee murphy
    Commented Apr 1, 2016 at 9:13

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.