After updating to Magento 2.1.16 on my staging server with nginx server and php7.0 I am facing issue in compiling less and css files.
The files styles-l.css and styles-m.css are missing - not generated.
During static contend deploy I get errors:
Compilation from source: /srv/www/rmstaging/public_html/vendor/magento/theme-frontend-blank/web/css/styles-l.less
Compilation from source: frontend/Smartwave/porto_rtl/en_US/css/styles-l.less variable @modal-popup-breakpoint-screen__m is undefined in file /srv/www/rmstaging/public_html/var/view_preprocessed/css/frontend/Smartwave/porto_rtl/en_US/Magento_Checkout/css/source/module/checkout/_tooltip.less in _tooltip.less on line 11, column 41
I tried many solution including on given in https://stackoverflow.com/questions/50764127/magento-2-less-compilation-error-while-setupstatic-contentdeploy-and-frontend given by @Ashsih Raj. But did not work either.
I had the same issue on localhost but that was fixed mysteriously. I think the only change is that on my localhost I compiles using PHP7.1
Please advise.
- 
 You can delete this file if it is not necessaryMagetop E-commerce– Magetop E-commerce2018年12月08日 09:34:31 +00:00Commented Dec 8, 2018 at 9:34
- 
 Which file should be deleted?Abid Malik– Abid Malik2018年12月08日 15:08:38 +00:00Commented Dec 8, 2018 at 15:08
- 
 Delete file .less you have the errorMagetop E-commerce– Magetop E-commerce2018年12月13日 03:40:34 +00:00Commented Dec 13, 2018 at 3:40
- 
 @VuTranKien Did that already but no use.Abid Malik– Abid Malik2018年12月13日 06:33:25 +00:00Commented Dec 13, 2018 at 6:33
6 Answers 6
For all Porto Theme users upgrading to Magento 2.3:
Edit the following files (also other language codes if available):
app/design/frontend/Smartwave/porto/Magento_Checkout/web/css/source/module/checkout/_tooltip.less
app/design/frontend/Smartwave/porto_rtl/Magento_Checkout/web/css/source/module/checkout/_tooltip.less
Replace the following piece of code, found on line 11:
@checkout-tooltip-breakpoint__screen-m: @modal-popup-breakpoint-screen__m;
with the following code:
@checkout-tooltip-breakpoint__screen-m: @screen__m;
Diff
11c11
< @checkout-tooltip-breakpoint__screen-m: @modal-popup-breakpoint-screen__m;
---
> @checkout-tooltip-breakpoint__screen-m: @screen__m;
Please note: In current versions of the Porto Theme there is a Patch included for Magento 2.3!
- 
 the correct line is like in the diff:@checkout-tooltip-breakpoint__screen-m: @screen__m;We had the en_GB version,so the error code if anyone is wondering was:report.ERROR: variable @modal-popup-breakpoint-screen__m is undefined in file [...]/var/view_preprocessed/pub/static/frontend/Smartwave/porto/en_GB/Magento_Checkout/css/source/module/checkout/_tooltip.less in _tooltip.less on line 11, column 41Savvas Radevic– Savvas Radevic2019年03月29日 00:08:02 +00:00Commented Mar 29, 2019 at 0:08
- 
 2Please note: In current versions of the Porto Theme there is a Patch included for Magento 2.3! that was the most important for my Magento v.2.3.1 installation.kanenas– kanenas2019年05月16日 15:08:34 +00:00Commented May 16, 2019 at 15:08
- 
 3After applying the patch, also delete the var/view_processed folder before retrying the deploy.Huby– Huby2019年05月19日 20:13:08 +00:00Commented May 19, 2019 at 20:13
Update:
This is not a permanent fix, but to get your website back up & running,
/frontend/Smartwave/porto/Magento_Checkout/web/css/source/module/checkout
Rename _tooltip.less to _tooltip.less-removed
Remember to clear your cached files & redeploy:
rm -rf pub/static/ var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy
Same issue here with magento version 2.3.1
It is Always Porto theme breaking my sites.
My advice Porto Theme there is a Patch included for Magento. The file is called Patch for Magento 2.3.x.zip This will resolve your issues. Apply this patch please and after this you should be fine again.
Step 1 download the latest Porto magento 2 theme package.
Step 2 unpack/extract all files and folders
Step 3 unpack/extract all files from the \Theme Files\Magento 2.x\Patch for Magento 2.3.1 And Above.zip if you not have done this yet **and the one that resolves your issues \Theme Files\Magento 2.x\Patch for Magento 2.3.x.zip
Upload the folder app from both patches (or the ones you did not applied) with Filezilla (or any ftp program you use) to your public_html folder or whatever magento installation folder you use.
Problem solved.
New problem from Porto Theme: Check your front end categories. Mine are not working any more after updating Porto theme but this is another issue i am working on.
Define @modal-popup-breakpoint-screen__m in your theme. Here is the location:
Magento_Checkout/css/source/module/checkout/_tooltip.less
- 
 tried this but did not work. I see the files css/styles-l.css and css/styles-m.css are still missing.Abid Malik– Abid Malik2018年12月08日 17:22:19 +00:00Commented Dec 8, 2018 at 17:22
- 
 I think you missing your less file where define all constant. Make sure that you have all less file otherwise you can't proceed with it.Sohel Rana– Sohel Rana2018年12月09日 01:38:44 +00:00Commented Dec 9, 2018 at 1:38
- 
 Thank you for the help. I already did it and it worked a bit. But there were other sections of the theme which were broken.Abid Malik– Abid Malik2018年12月10日 17:04:04 +00:00Commented Dec 10, 2018 at 17:04
- 
 Thank you for the help. I already did it and it worked a bit. But there were other sections of the theme which were broken. Finally, after spending some more issue, I found that after upgrade to Magento 2.1.16 somehow the theme fallback is not working. I am using custom theme -> child of Smartwave Porto theme -> child of Magento Blank. When doing static_content deploy, the CSS from porto is not loaded especially for Checkout module. I copied the files from porto to custom theme and it worked. BUT I DON'T THINK IT IS PROPER SOLUTION. AND ONE MORE THING THE WHOLE THING IS WORKING FINE ON LCLHSTAbid Malik– Abid Malik2018年12月10日 17:09:50 +00:00Commented Dec 10, 2018 at 17:09
- 
 I just copied files from parent theme SmartWave Porto to My Child theme and things worked. But I need more robust solution.Abid Malik– Abid Malik2018年12月30日 08:44:05 +00:00Commented Dec 30, 2018 at 8:44
To fix the LESS compilation error in Magento 2 caused by ceil() function misuse, apply this regex replacement across your .less files:
- Find: - ceil\(([^;]+)\);
- Replace with: - ceil((1ドル));
This transforms invalid calls like:
ceil(1px + 1); // ❌
Into valid syntax:
ceil((1px + 1)); // ✅
Magento 2 uses the Wikimedia LessPHP compiler, not the Node.js LESS engine. This PHP-based compiler is strict with function syntax, especially when functions like ceil(), floor(), or round() receive math expressions as arguments.
For example:
ceil(1px + 1); 
will trigger a compilation error because the parser cannot resolve the argument unambiguously. The solution is to wrap the entire expression in an extra set of parentheses, like so:
ceil((1px + 1));
This makes the syntax compliant with LessPHP's grammar expectations and resolves the error during bin/magento setup:static-content:deploy.
Use the regex above to apply this fix project-wide, improving developer ergonomics and avoiding hard-to-debug LESS compilation failures.
For myself, I was getting:
Compilation from source: vendor/magento/theme-frontend-blank/web/css/styles-m.less Unable to get content for 'frontend/Magento/blank/en_AU/css/source/components/_modals.less'
Quick Fix
I found removing the vendor then re-installing:
rm -rf vendor/
composer -n install
Immediately solved the issue when running php bin/magento setup:static-content:deploy, but then it would fail once again after the first deploy.
Permanent Fix
Searching for this file in vendor helped me
find . -type f -name "_modals.less" | grep -i "source/components"
./vendor/magento/magento2-base/lib/web/css/source/components/_modals.less
./lib/web/css/source/components/_modals.less
These 2 files were identical for me
Copying one of these files into my theme directory resolved these for future deploys:
mkdir -p ./app/design/frontend/<MY_VENDOR>/<MY_THEME>/web/css/source/components
cp ./vendor/magento/magento2-base/lib/web/css/source/components/_modals.less ./app/design/frontend/<MY_VENDOR>/<MY_THEME>/web/css/source/components/_modals.less