Hi all,
I get the following errors when using the setup:static-content:deploy command.
My theme edits are from Magento 2.2.3 and I'm testing it on Magento 2.3.5.
The css/less files in the error messages, I do not have in my own custom theme.
I have tried adding them to see if it fixes it, but it still throws the undefined error.
How can I go about resolving this?
An image showing the errors:
an example:
Compilation from source: /var/www/vhosts/[Removed].co.uk/[Removed].co.uk/lib/web/mage/gallery/gallery.less variable @theme__color__primary is undefined in file /var/www/vhosts/[removed].co.uk/[removed].co.uk/var/view_preprocessed/pub/static/frontend/Kidsaw/kidmag2/en_GB/css/source/lib/variables/_typography.less in _typography.less on line 86, column 15 84| // --------------------------------------------- 85| 86| @link__color: @theme__color__primary; 87| @link__text-decoration: none; 88|
Hello,
try to run below command
php bin/magento setup:upgrade or remove below folder
rm -rf var/view_preprocessed
rm -rf var/cahe
rm -rf generated/*
Then try to run static content deploy
Hello @callam_kidsaw,
In your theme you have one less file named as _typography.less in which you are using
@theme__color__primary
Variable instead of direct color.
Try to specify this variable in _variable.less or use the direct color instead of variable in above less file.
Clear below folders and run
rm -rf var/view_preprocessed
rm -rf var/cahe
rm -rf generated/*
php bin/magento setup:static-content:deploy -f
Hope this helps you!
Problem Solved! Click Kudos & Accept as Solition!
Thank you both, I will try these and let you know the results. The first reply with the removal commands of /var/cache, generated and /var/view_preprocessed did not work.
I will now try setting the colour.
can you confirm if _variable.less goes in the web\css\source folder of my theme? I've set the colours but the same error is being produced when deploying.
Hi @callam_kidsaw,
Can you check below link related to your issue.
Hope this helps you!
Problem Solved! Click Kudos & Accept as Solution!
Thanks, what I am doing is correct.
I've defined the colours as indicated above and it got rid of my original errors, but it is also producing more when using the deploy command.
New styles must have been added or the current ones changed in the base LUMA theme between 2.2.3 and 2.3.5.
Not sure how to get rid of the constant errors, If I carry on one by one it could take me awhile to eliminate them all.
EDIT:
I've noticed my mistake - instead of setting my custom styles in their own css/less file, I just copy and pasted for example _navigation.less from the LUMA theme into my own theme style which is causing these conflicts.