During the process of updating my Magento2 website, the console commands fail to create my main.js file, and shows me this error static/frontend/website/default/pt_PT/js/main.js net::ERR_ABORTED 404 (Not Found)

I've tried to flush the cachem, re-index, and update

>Clean cache
 php bin/magento cache:clean

 php bin/magento setup:upgrade

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

 php bin/magento indexer:reindex

 php bin/magento setup:di:compile

But it did nothing basically, because i always end up getting the 404 cannot find main.js file. This might be causing some other problems in my magento website.

I've already checked this question and this question

  • Where the main.js file is located in your theme or module? Jun 18, 2020 at 16:44
  • The main.js is located on my app folder, so i'm guessing my theme. i'm fairly new to magento sorry! Jun 18, 2020 at 16:46
  • Let me know full path to the js file, please - probably, the issue in the wrong path. Jun 18, 2020 at 16:48
  • the full relative path is app/design/frontend/website/default/Magento_Theme/web/js/main.js Jun 18, 2020 at 16:50
  • Try to place the file in app/design/frontend/website/default/web/js/main.js (without Magento_Theme folder) and after regenerating static files it should be available by pub/static/frontend/website/default/pt_PT/js/main.js Jun 18, 2020 at 16:57

1 Answer 1


First, check if var/ and pub/ folders have proper permissions, then run below commands in same order:

  • rm -rf generated
  • php bin/magento indexer:reindex
  • php bin/magento setup:upgrade
  • php bin/magento setup:di:compile
  • php bin/magento setup:static-content:deploy -f
  • php bin/magento cache:clean
  • Didn't work, the problem still persists. Jun 19, 2020 at 8:56
  • rm -rf /pub/static/ and then try. Also, if possible call me on skype pankaj.damco!
    – Pankaj
    Jun 19, 2020 at 19:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.