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?

asked Jul 9, 2020 at 12:47

1 Answer 1

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 .
answered Jul 9, 2020 at 15:42
3
  • Thanks man! Should I repeat this command every time I make changes to the site? Commented Jul 9, 2020 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 :) Commented Jul 9, 2020 at 16:06
  • Thank you man! As soon as I finish the changes I will launch the code you have indicated to me. :) Commented Jul 10, 2020 at 7:32

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.