Magento2: Missing variable for copyright background color in _module.less

Created on 22 Nov 2017  路  18Comments  路  Source: magento/magento2

Since upgrading to Magento 2.2.1 from 2.0.7 compilation of _module.less fails as there is a missing variable for @copyright__background-color

https://github.com/magento/magento2/blob/9fc1138d1af7065090a7d32e6d58f4262dc5205c/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less#L263

Preconditions

  1. Magento 2.2.1
  2. PHP 7

Steps to reproduce

Try and compile CSS

Expected result

Compilation should work

Actual result

variable @copyright__background-color is undefined in file /var/www/html/magento2/var/view_preprocessed/pub/static/frontend/GM/gm/en_GB/Magento_Theme/css/source/_module.less in _module.less on line 439, column 40 437| body { 438| .ie9 & { 439| .lib-css(background-color, @copyright__background-color); 440| } 441| } 442| in _responsive.less

Fix

Add a variable:

@copyright__background-color: @color-gray-middle4;

Fixed in 2.2.x Clear Description Confirmed Format is valid Reproduced on 2.1.x

Most helpful comment

Had the same issue today. I have copied only the following line to the app\design\frontend{Vendor}{currentThemeName}\web\css\source_theme.less

@copyright__background-color: @color-gray-middle4;

All 18 comments

@pixel-paul, thank you for your report.
The issue is already fixed in 2.2.1

Any idea why it happened on my version of Magento 2.2.1 then?

Same problem, Magento 2.2.1

Same problem, Magento 2.2.1

Same problem, Magento 2.2.1

Same problem, Magento 2.2.1.

Same problem, Magento 2.2.2 fresh install

@kwebmaster perhaps copy my issue and raise it again? This ticket has been closed.

same 2.2.2

@magento-engcom-team new installation 2.2.2 I am having this issue with a custom theme but not on Luma
.../themeName/en_GB/css/styles-m.css 404
.../themeName/en_GB/css/styles-l.css 404

try to force php bin/magento setup:static-content:deploy en_GB -f

Deploy using quick strategy
frontend/Magento/blank/en_GB            2108/2108           ============================ 100% %  8 secs              
adminhtml/Magento/backend/en_GB         2105/2105           ============================ 100% %  9 secs              
frontend/Magento/luma/en_GB             2124/2124           ============================ 100% %  10 secs             
frontend/themeName/default/en_GB            2009/2177           =========================>-- 92% %   5 secs
Compilation from source: /var/www/vhosts/user/htdocs/vendor/magento/theme-frontend-blank/web/css/styles-m.less
variable @copyright__background-color is undefined in file /var/www/vhosts/user/htdocs/var/view_preprocessed/pub/static/frontend/themeName/default/en_GB/Magento_Theme/css/source/_module.less in _module.less on line 263, column 36
261| 
262|     .copyright {
frontend/Magento/blank/en_GB            2108/2108           ============================ 100% %  8 secs              
adminhtml/Magento/backend/en_GB         2105/2105           ============================ 100% %  9 secs              
frontend/Magento/luma/en_GB             2124/2124           ============================ 100% %  10 secs             
frontend/themeName/default/en_GB            2012/2177           =========================>-- 92% %   7 secs
Compilation from source: /var/www/vhostsuser/htdocs/vendor/magento/theme-frontend-blank/web/css/styles-l.less
variable @copyright__background-color is undefined in file /var/www/vhosts/user/htdocs/var/view_preprocessed/pub/static/frontend/themeName/default/en_GB/Magento_Theme/css/source/_module.less in _module.less on line 439, column 40
437|     body {
438|         .ie9 & {
frontend/Magento/blank/en_GB            2108/2108           ============================ 100% %  8 secs              
adminhtml/Magento/backend/en_GB         2105/2105           ============================ 100% %  9 secs              
frontend/Magento/luma/en_GB             2124/2124           ============================ 100% %  10 secs             
frontend/themeName/default/en_GB            2135/2177           ===========================> 98% %   8 secs

  [Magento\Framework\Exception\FileSystemException] 

  Cannot read contents from file "/var/www/vhosts/user/htdocs/pub/static/frontend/themeName/default/en_GB/css/styles-m.css" Warning!file_get_contents(/var/www/vhosts/user/htdocs/pub/static/frontend/themeName/default/en_GB/css/styles-m.css):` failed to open stream: No such file or directory

what's the fix?

this helped me https://github.com/magento/magento2/issues/8377

Same problem in 2.2.4 when running

php bin/magento setup:static-content:deploy -f

But when I run with specified language (en_GB) it deploys the static content without issue:

php bin/magento setup:static-content:deploy en_GB -f

Having the same problem in 2.2.5 when using a custom theme based on Luma:

Running "less:cosmetic_en" (less) task NameError: variable @copyright__background-color is undefined in pub/static/frontend/ohitsgreen/cosmetic/en_US/Magento_Theme/css/source/_module.less on line 263, column 36: 262 .copyright { 263 .lib-css(background-color, @copyright__background-color); 264 .lib-css(color, @color-white); Warning: Error compiling pub/static/frontend/ohitsgreen/cosmetic/en_US/css/styles-m.less Use --force to continue. Aborted due to warnings.

  1. Copy _extends.less and _theme.less from vendor\magento\theme-frontend-luma\web\css\source\ to app\design\frontend\{Vendor}\{currentThemeName}\web\css\source\

  2. Clear the content of pub/static and var/view_preprocessed except .htaccess

  3. Clean the cache: php bin/magento cache:clean

  4. Compile : php bin/magento setup:static-content:deploy -f

Had the same issue today. I have copied only the following line to the app\design\frontend{Vendor}{currentThemeName}\web\css\source_theme.less

@copyright__background-color: @color-gray-middle4;

@EliasKotlyar, perhaps raise a new ticket, as this has been closed by the @magento-engcom-team.

I'm on 2.3.3 and I have a very simple child theme that extends luma. I have a blank _theme.less and _extends.less and I ran into the same error with the copyright background color. Running setup:upgrade fixed the issue for me. I'm not sure if that will help anyone else but I thought I would post it here just in case.

I'm on 2.3.3 and I have a very simple child theme that extends luma. I have a blank _theme.less and _extends.less and I ran into the same error with the copyright background color. Running setup:upgrade fixed the issue for me. I'm not sure if that will help anyone else but I thought I would post it here just in case.

Yes, helps a lot, by the way just created child theme with this tutorial
https://www.dckap.com/blog/how-to-create-child-theme-in-magento2/

same probleme

Compilation from source: /var/www/structube/vendor/magento/theme-frontend-blank/web/css/styles-m.less
variable @copyright__background-color is undefined in file /var/www/structube/var/view_preprocessed/pub/static/frontend/luma/luma_child/en_US/Magento_Theme/css/source/_module.less in _module.less on line 284, column 36
282|
283| .copyright {
284| .lib-css(background-color, @copyright__background-color);

Was this page helpful?
0 / 5 - 0 ratings