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

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;

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 18 (3 by maintainers)

Most upvoted comments

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;

  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

Same problem, Magento 2.2.2 fresh install

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.

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

@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, Magento 2.2.1

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

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