1

In my Magento 2 site every time I try to clear the static file cache and try to reload the page in the frontend, several errors come out in the JS console, as if there were continuous conflicts between the various js files.

But when I try to clean up the Magento cache and reload the page in the frontend, the console problems disappear. Has this happened to anyone?

It is as if Magento does not regenerate the js files in the pub / static folder ...

What could I do?

1
php bin/magento setup:static-content:deploy -f

This should do it !

UPDATE:

php bin/magento setup:upgrade
php setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

You should also be aware that due to Linux file permissions sometimes you need to give permission to the apache user to "use" the files created.

sudo chmod -R  +775  .
  • Thanks man! Should I repeat this command every time I make changes to the site? – Jackom Jul 9 '20 at 16:04
  • No, only when you are adding new stuff. otherwise just compiling should be enough. Please upvote and mark as answer please. I0ve added my script wich I execute when I make large changes to my site in order to keep everything clean and up to date :) – Joao71 Jul 9 '20 at 16:06
  • Thank you man! As soon as I finish the changes I will launch the code you have indicated to me. :) – Jackom Jul 10 '20 at 7:32

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.