Skip to main content
83 votes
Accepted

Magento 2: How can I deploy my theme only

As of 2.1.1 you can now deploy specific themes or exclude themes: Deploy specific themes: php bin/magento setup:static-content:deploy --theme Magento/backend --theme Vendor/mytheme Exclude themes: ...
Mathew Tinsley's user avatar
37 votes
Accepted

Static Content is not loading after upgrade

The main issue was caused by the incorrect rewrites work ( as @Marius told ). There was no RewriteBase in my directory pub/static/ and Apache could not find the files because searched for them from ...
Siarhey Uchukhlebau's user avatar
25 votes

Strange Error when running setup:upgrade after module installation

In my case, I ran php bin/magento setup:static-content:deploy and the error disappeared.
Kunsal Ajay's user avatar
22 votes
Accepted

@media-common - Why do we need to use this?

Magento 2 follows Mobile First approach and @media-common = true was designed to define styles that are base (mobile) and must be present in styles-m.css. If you drop this declaration styles will be ...
Olga's user avatar
  • 336
18 votes

Magento 2: How can I deploy my theme only

In Magento 2 you are able to content deploy specific themes and also exclude themes by this commands: Content Deploy specific themes By this command: php bin/magento setup:static-content:deploy --...
Prince Patel's user avatar
  • 22.8k
17 votes

Magento 2 CSS and JavaScript not loading from correct folder

you just need to update the apache2.conf file. On Ubuntu 16.04 Open and edit the file /etc/apache2/apache2.conf Navigate to the place in the apache2.conf file <Directory /var/www/> Change "...
S.A's user avatar
  • 171
14 votes

Magento 2 CSS and JavaScript not loading from correct folder

For me it was simply because mod_rewrite wasn't enabled. sudo a2enmod rewrite and service apache2 restart
Haim's user avatar
  • 2,144
14 votes
Accepted

Magento 2: Static files are present but shows 404

First, make sure apache “rewrite_module” is enable and then restart the server. If this hasn't worked. Then do following steps: Edit the file /etc/apache2/apache2.conf. Find this code: <...
D Singh's user avatar
  • 1,144
13 votes

Magento 2 CSS and JavaScript not loading from correct folder

Here is the simplest solution if showing version name in css path like : pub/static/version323334/ then run this query in mysql INSERT INTO core_config_data (path, value) VALUES ('dev/static/sign',...
Surendra Kumar Ahir's user avatar
13 votes

Unable to retrieve deployment version of static files from the file system

Seems you have converted your store from the developer mode to the production mode and now the system is not able to create the folders and files automatically. For the same, try below steps php bin/...
zuber bandi's user avatar
  • 1,062
12 votes

Fatal error: Class 'Locale' not found magento 2.0.2

This error occurs when you do not have php's intl extension. For futher info. you can chk https://github.com/magento/magento2/issues/2316 Run Grunt deploy task -> Fatal error: Class 'Locale&...
Arjun's user avatar
  • 3,586
11 votes

Magento 2 CSS and JavaScript not loading from correct folder

If you are facing problem of css and js page load design after installation in magento2 please follow the following step-: open the terminal and navigate to magento web root $ cd /var/www/html/...
Arvind's user avatar
  • 119
11 votes

Magento 2: Static files are present but shows 404

I have same issue and its occurs when i am was deleted pub/static folder. And its Resolved after placing missing .htaccess file in static folder <IfModule mod_php5.c> php_flag engine 0 </...
Ravi Oza's user avatar
  • 478
10 votes

Magento 2: How can I deploy my theme only

Here is shortcut to deploy only your theme -a for area -t for theme -l for language php bin/magento setup:static-content:deploy -l en_US -a frontend -t Magento/luma Source
Qaisar Satti's user avatar
  • 32.5k
9 votes
Accepted

Magento 2 - How to view static content deploy errors

I reckon there's several types of errors that can be triggered by the deployment. First you can see that Exception are handled directly in the execution in Magento/Deploy/Console/Command/...
Raphael at Digital Pianism's user avatar
9 votes

Static Content is not loading after upgrade

If you are running Nginx, here is the fix. You probably have your own conf file, you need to update the /static/ part with this, they have updated part of it specifically: # Remove signature of the ...
Kevin Chavez's user avatar
9 votes

There are no commands defined in the "setup:static-content" namespace

first run the cmd composer install in you folder then run this cmd php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy (or) php bin/magento ...
SNS's user avatar
  • 905
8 votes

Magento 2 setup:static-content:deploy symlinks

I was able to resolve this by adding this node in app/etc/di.xml <type name="Magento\Deploy\Model\Deploy\LocaleDeploy"> <arguments> <argument name="...
Sergey Boyko's user avatar
8 votes
Accepted

After changing default theme to custom theme contents and blocks missing

By Default magento 2 with sample data with luma themes used Widget to display static content in homepage and all parent category(What's New, Women, men, gear etc..) in luma theme. In Luma Themes all ...
Rakesh Jesadiya's user avatar
7 votes

Magento 2 CSS and JavaScript not loading from correct folder

I had the same issue resolved by adding sudo nano /etc/apache2/apache2.conf Modify this <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None ...
Chaitanya's user avatar
  • 107
7 votes

Static Content is not loading after upgrade

Go to the database and insert a row in core_config_data table: INSERT INTO core_config_data (scope, scope_id, path, value) VALUES ('default', 0, 'dev/static/sign', '0');
Saphal Jha's user avatar
  • 1,883
7 votes
Accepted

Magento2: Wrong path of static contents

This is due to Magento "Signing" the files. Essentially it forces Magento to regenerate the public static files on page reload by adding the current timestamp to the files. This may have changed due ...
Richard Cripps's user avatar
7 votes
Accepted

Magento2 developer mode doesnt generate static files on demand

If you are in Apache: Check you have the correct .htaccess file under pub/static folder https://github.com/magento/magento2/blob/2.2/pub/static/.htaccess. Check https://github.com/magento/magento2/...
B G Kavinga's user avatar
  • 1,266
6 votes

Missing write permissions in directory pub/static when run bin/magento setup:upgrade

Inside your Magento root directory run the commands below and your issue should be gone: $ rm -rf pub/static/* $ php bin/magento setup:static-content:deploy Worked for me.
medina's user avatar
  • 565
6 votes
Accepted

How to get url for static image file in Magento2 javascript files?

you can make your function as a jQuery UI widget and then call it from the template and sending the image url as a parameter. For an idea on how to create a UI widget you can check how the ...
Marius's user avatar
  • 198k
6 votes

Knockout HTML template being cached

From my experience, we should disable Browser Cache when developing. It's one of the way for preventing Browser Cache, not full answer to this quesion. For example: Chrome: Network tab > Disable ...
Khoa TruongDinh's user avatar
6 votes

Strange Error when running setup:upgrade after module installation

It seems to have nothing to do with the google module. It can happen after any deployment; especially if you are dealing with Magento in production mode. Running bin/magento setup:upgrade removes ...
hey's user avatar
  • 1,137
6 votes
Accepted

Dont remove pub/static content in setup:upgrade command

you can tell Magento not to get rid of generated code and static files: magento setup:upgrade --keep-generated From docs: where --keep-generated is an optional argument that does not update ...
Andrew's user avatar
  • 266
6 votes

Custom theme - styles-m.css failed to open stream: No such file or directory

I was facing the same problem after creating a custom theme. Whenever I tried to deploy the static content using command: php bin/magento setup:static-content:deploy -f I was facing an error saying:...
Usman Yousaf's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible