cancel
Showing results for 
Search instead for 
Did you mean: 

bin/magento setup:static-content:deploy does not overwrite existing files in pub/static

bin/magento setup:static-content:deploy does not overwrite existing files in pub/static

Hello Forum

 

i have a question, i'm not sure if this standard magento behaviour or not. 

 

our setup: Magento 2.3.3 in production mode

issue description:

 

1.
i make a file change in:

/app/design/frontend/my/theme/Magento_Checkout/web/template/shipping-address/address-renderer/default.html



2. i want to deploy the file on our production system and run:

php bin/magento setup:static-content:deploy de_CH en_US fr_FR -s -f


3. i would expect that this file now is updated in:

/pub/static/frontend/my/theme/de_CH/Magento_Checkout/template/shipping-information/address-renderer/default.html


but it does not get overwritten. Only when i delete the file, it gets generated with updated version.

 

Of course i can solve this by purging pub/static folder before deploying, but this will take my site down while deploying is not finished:

 

rm -rf pub/static

Is this really default magento behaviour?

 

thanks for your help

Stefan

 

6 REPLIES 6

Re: bin/magento setup:static-content:deploy does not overwrite existing files in pub/static

Hello @silverzone 

 

Please run the below commands:

  1. php bin/magento setup:upgrade
  2. php bin/magento setup:static-content:deploy de_CH en_US fr_FR -s -f

Hope it helps.

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: bin/magento setup:static-content:deploy does not overwrite existing files in pub/static

Thanks for your message. So this means, its not possible to upgrade in production mode without any downtime?

Re: bin/magento setup:static-content:deploy does not overwrite existing files in pub/static

Hello@silverzone again,

 

You have to remove all files from pub/static folder after override.

 

That's why we need to run these commands.

 

Thanks

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: bin/magento setup:static-content:deploy does not overwrite existing files in pub/static

I have setup: static-content but facing the same issue

When I run the php bin/magento setup:upgrade command facing this error 

 

ErrorError

Re: bin/magento setup:static-content:deploy does not overwrite existing files in pub/static

Hey @Savan,

 

Please execute below SQL command :

 

SET FOREIGN_KEY_CHECKS=0;
UPDATE `store` SET store_id = 0 WHERE code='admin';
UPDATE `store_group` SET group_id = 0 WHERE name='Default';
UPDATE `store_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

 Reference: https://magento.stackexchange.com/questions/156176/magento-2-requested-store-is-not-found/156195

 

Thanks

Re: bin/magento setup:static-content:deploy does not overwrite existing files in pub/static

You need to use flag "-f".
So it is:
bin/magento setup:static-content:deploy -f