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– Kingshuk Deb2017年04月11日 09:57:47 +00:00Commented Apr 11, 2017 at 9:57
-
1Yes, I tried it but no sinlge min.js file was generated .Pete Jaworski– Pete Jaworski2017年04月11日 10:20:03 +00:00Commented Apr 11, 2017 at 10:20
-
2Same problem, ever figure it out?Matt Cosentino– Matt Cosentino2017年09月18日 19:09:31 +00:00Commented Sep 18, 2017 at 19:09
4 Answers 4
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
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?
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
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 generatedPete Jaworski– Pete Jaworski2017年04月11日 10:54:11 +00:00Commented Apr 11, 2017 at 10:54