4

My environment:

  • Magento 2.0.4
  • Production mode enabled
  • Cache enabled.

I wanted to speed up my Magento 2 store by minifying all Javascript codes. I enabled the JS Minifying option in admin panel and left the rest options (merging and budnling) set to 'no'.

After that all JS scripts stopped working: menus, cart, checkout etc.

There are many errors in console listed. However, they are mainly about missing min.js files. They were simply didn't generated somehow.

Please let me know how to fix it.

  • Have you deployed static contents? Use php bin/magento setup:static-content:deploy to deploy static contents. – Kingshuk Deb Apr 11 '17 at 9:57
  • Yes, I tried it but no sinlge min.js file was generated . – Pete Jaworski Apr 11 '17 at 10:20
  • 1
    Same problem, ever figure it out? – Matt Cosentino Sep 18 '17 at 19:09
1

In my case this error happens when i have not setup permission correctly.

Try running:

sudo find . -type d -exec chmod 770 {} \; && sudo find . -type f -exec chmod 660 {} \;  && sudo chmod u+x bin/magento
sudo chown -R $(whoami):www-data .

Change www-data to appropriate web server user. e.g. apache or www-data

0

The next step would be to see if you can find the file it's trying to load on the filesystem. If it's there, it would point to a web server configuration problem instead. Which web server are you on apache2 or nginx?

0

Just to mention solution that worked for me - if you use multiple languages then make sure you try deploying static content with explicitly specify languages

php bin/magento setup:static-content:deploy en_US sk_SK

Of course change language codes accordingly

-1

please also enable "Enable JavaScript Bundling" option

store->configuration->advanced->developer->javascript setting->

Enable JavaScript Bundling set to "yes"

and flus cache

I hope it's help you

after Enable JavaScript Bundling run following command

rm -rf pub/static/*
php bin/magento cache:clean
php bin/magento cache:flush 
php bin/magento setup:static-content:deploy
  • It didn't help. Still no minified JS files generated – Pete Jaworski Apr 11 '17 at 10:54

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.