cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 Grunt fails weird unrelated variable undefined?

Magento 2 Grunt fails weird unrelated variable undefined?

I recently built a new fresh theme for Magento 2 and wanted to make a start on styling the buttons, inputs etc globally, I've set my local-themes file to the right position and set it up as it should. Whenever I do grunt refresh I get this strange error that has nothing to do with that I am trying to accomplish

 

>> SyntaxError: variable @form-field__vertical-indent__desktop is undefined in pub/static/frontend/{Vendor}/{Theme}/nl_NL/css/source/lib/_responsive.less on line 64, column 9:
>> 63 print {
>> 64 .media-width('min', @screen__m);
>> 65 }
Warning: Error compiling pub/static/frontend/{Vendor}/{Theme}/nl_NL/css/styles-l.less Used --force, continuing.

 

 

My theme's folder structure is really simple, it barely has any files.

 

Theme
    |--> media
    |--> web
         |--> css
         |--> source
                   |--> _sources.less
                   |--> _theme.less

And of course the necessary things such as registration.php, theme.xml but that is self-explanatory. Why can't I compile my grunt files? I've tried defining the variable within the _theme.less file like this

 

 

 

`@form-field__vertical-indent__desktop: 28px;`

 

 

and grunt then compiles successfully but the homepage is still missing styles. It then says the following in the console

 

 

Refused to apply style from 'https://www.{project}.test/pub/static/version1615894401/frontend/{Vendor}/{theme}/nl_NL/css/styles-l.css' because its MIME type ('text/plain') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

 

 

Also whenever I try to run `bin/magento setup:static-content:deploy` I get this error:

 

Compilation from source: /Users/rainierlaan/Sites/work/{project}/vendor/magento/theme-frontend-blank/web/css/styles-l.less
variable @form-field__vertical-indent__desktop is undefined in file /Users/rainierlaan/Sites/work/{project}/var/view_preprocessed/pub/static/frontend/{Vendor}/{Theme}/en_US/Magento_GiftRegistry/css/source/_module.less in _module.less on line 213, column 28
211| .form-giftregistry-search {
212| .fieldset {
213| margin-bottom: @form-field__vertical-indent__desktop;

 

The weird thing is. Nowhere within my project I called or defined or did anything related or regarding to Magento_GiftRegistry? I can't disable or remove the module GiftRegistry becuase it isn't even installed? It does not show up when I do `bin/magento module:status` What in the world is going on here?

 

What I've tried

 

rm -rf /var/view_preproccessed
rm -rf /pub/static
bin/magento setup:upgrade
bin/magento cache:flush
bin/magento cache:clean
bin/magento setup:static-content:deploy


Where is this error coming from and how can I fix it? It's driving me nuts

1 REPLY 1

Re: Magento 2 Grunt fails weird unrelated variable undefined?

Did you find a solution? I'm dealing with the same thing.