Magento 2 – Fixing Invalid Type Error in _typography.less, _utilities.less, and _listings.less

csslessmagento2

Updated to Magento 2.3.2 yesterday and have noticed that the CSS for css/styles-m.css is failing to generate with the below error:

Operation on an invalid type in _typography.less in _utilities.less in _listings.less
<pre>#1 Magento\Framework\View\Asset\PreProcessor\AlternativeSource->processContent('css/styles-m.css', '', '', &Magento\Framework\View\Asset\File\FallbackContext#000000006569326b00000000204f06bd#) called at [vendor/magento/framework/View/Asset/PreProcessor/AlternativeSource.php:114]
#2 Magento\Framework\View\Asset\PreProcessor\AlternativeSource->process(&Magento\Framework\View\Asset\PreProcessor\Chain#000000006569327400000000204f06bd#) called at [vendor/magento/module-developer/Model/View/Asset/PreProcessor/PreprocessorStrategy.php:76]
#3 Magento\Developer\Model\View\Asset\PreProcessor\PreprocessorStrategy->process(&Magento\Framework\View\Asset\PreProcessor\Chain#000000006569327400000000204f06bd#) called at [vendor/magento/framework/View/Asset/PreProcessor/Pool.php:77]
#4 Magento\Framework\View\Asset\PreProcessor\Pool->process(&Magento\Framework\View\Asset\PreProcessor\Chain#000000006569327400000000204f06bd#) called at [vendor/magento/framework/View/Asset/Source.php:152]
#5 Magento\Framework\View\Asset\Source->preProcess(&Magento\Framework\View\Asset\File#000000006569326e00000000204f06bd#) called at [vendor/magento/framework/View/Asset/Source.php:105]
#6 Magento\Framework\View\Asset\Source->getFile(&Magento\Framework\View\Asset\File#000000006569326e00000000204f06bd#) called at [vendor/magento/framework/View/Asset/File.php:158]
#7 Magento\Framework\View\Asset\File->getSourceFile() called at [vendor/magento/framework/App/StaticResource.php:135]
#8 Magento\Framework\App\StaticResource->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#9 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\StaticResource#00000000656932b800000000204f06bd#) called at [pub/static.php:13]
</pre>

I removed any less files from my custom theme however the issue remained. I am in developer mode and deleted all static files to make sure they are getting regenerated however this error persists breaking styles within my store.

Any ideas why the less compilation may have changed or a way to debug with actual file paths and line numbers so this can be narrowed down further?

UPDATE

As stated this was the typography.less in my theme. Just deleting the file while in developer mode didn't seem to help however. Neither did the deploy static content command. Setting production mode however seemed to work fine which allowed me to go back to developer mode with everything working fine from then on. May be a quicker step to kick this into action but for me the above worked.

Best Answer

I have this issue at project. My solution at the time is to remove _typography.less from my custom template as it already exists in magento2-base/lib/web/cs/source/lib After removing it setup:static-content:deploy works as a charm.

Related Topic