Fix Library: Upgrades and compatibility
Static Content Deploy Errors After an Upgrade
Last updated:
What you see
setup:static-content:deploy fails with errors, or the store loads without styles after the upgrade.
Quick answer
Static content deploy builds the CSS and JavaScript your theme needs. After an upgrade it usually fails because a theme LESS file no longer compiles, the command runs without the -f flag outside production mode, or it runs out of memory. Hyvä themes also need their Tailwind CSS built separately.
What usually causes it?
- A LESS error in the theme or an extension after core files changed
- Running without -f in developer or default mode
- Not enough PHP memory
- Wrong file permissions on pub/static or var
- Hyvä Tailwind CSS not rebuilt
How do you check it safely?
These checks only read information. Run them on staging first if you can, from the Magento root folder as the file system owner. Hosting setups differ, so paths and service names may need adjusting.
- Run the deploy with more output to see the failing file.
bin/magento setup:static-content:deploy -f en_US -vvv - Check the deploy mode and the logs.
bin/magento deploy:mode:show tail -n 50 var/log/system.log - Check that the web server user can write to the static folders.
ls -ld pub/static var/view_preprocessed
How do you fix it?
These steps change your store. Run them on staging first, with a backup of code and database.
- Fix the LESS or JavaScript file named in the error, usually in the theme or a theme override.
- Clear old static files, keeping pub/static/.htaccess, then deploy again with your locales.
rm -rf pub/static/frontend pub/static/adminhtml var/view_preprocessed/pub bin/magento setup:static-content:deploy -f en_US en_GB - For Hyvä themes, build the Tailwind CSS in the theme, then deploy static content.
cd app/design/frontend/Vendor/theme/web/tailwind && npm ci && npm run build-prod - If it runs out of memory, raise the PHP memory limit for the command line or reduce parallel jobs.
bin/magento setup:static-content:deploy -f en_US --jobs=2
When should you call an expert?
Call an expert if the theme needs larger changes for the new version, or the deploy works on staging but fails in your deployment pipeline.
Need it fixed today?
I can look at it with you. Book a 20 minute call, or if the store is down, see emergency Magento support.
FAQ
Common questions.
Why does the store look broken but the deploy said it finished?
Often the browser or a CDN is still serving old files. Flush the Magento cache, purge the CDN and check the static file version in the page source.
Do I need to deploy every locale?
Only the locales your store views and admin users actually use. Fewer locales mean faster deploys.
Related
Rather have it fixed for you?
Send a few lines about the problem, or book a 20 minute call. You get an honest read and a fixed quote.