5

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.

Payal Patel
1,5111 gold badge20 silver badges40 bronze badges
asked Apr 11, 2017 at 9:54
3
  • Have you deployed static contents? Use php bin/magento setup:static-content:deploy to deploy static contents. Commented Apr 11, 2017 at 9:57
  • 1
    Yes, I tried it but no sinlge min.js file was generated . Commented Apr 11, 2017 at 10:20
  • 2
    Same problem, ever figure it out? Commented Sep 18, 2017 at 19:09

4 Answers 4

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

answered Oct 3, 2017 at 9:53
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?

answered Sep 18, 2018 at 22:11
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
answered Apr 11, 2017 at 10:41
1
  • It didn't help. Still no minified JS files generated Commented Apr 11, 2017 at 10:54

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.