2

I have searched the forum and there are a lot of entries related to this problem, but none of them provides a concrete solution and although I have tried almost all of them, I can not solve the error.

The situation: OS: Debian 8.9 PHP: 7.0.26 MySQL: 5.7.16 Apache: 2.4.23 Update of Magento 2.1.9 to 2.2.x (last test 2.2.2) ERROR:

1 exception(s):
Exception #0 (InvalidArgumentException): Unable to serialize value.

Exception #0 (InvalidArgumentException): Unable to serialize value.
#0 web/htdocs/vendor/magento/framework/Translate.php(501): Magento\Framework\Serialize\Serializer\Json->serialize(Array)
#1 web/htdocs/vendor/magento/framework/Translate.php(211): Magento\Framework\Translate->_saveCache()
#2 web/htdocs/vendor/magento/framework/App/Area.php(244): Magento\Framework\Translate->loadData('frontend', false)
#3 web/htdocs/vendor/magento/framework/App/Area.php(215): Magento\Framework\App\Area->_initTranslate()
#4 web/htdocs/vendor/magento/framework/App/Area.php(142): Magento\Framework\App\Area->_loadPart('translate')
#5 web/htdocs/vendor/magento/framework/View/DesignLoader.php(55): Magento\Framework\App\Area->load('translate')
#6 web/htdocs/vendor/magento/framework/App/Action/Plugin/Design.php(48): Magento\Framework\View\DesignLoader->load()
#7 web/htdocs/vendor/magento/framework/Interception/Interceptor.php(121): Magento\Framework\App\Action\Plugin\Design->beforeDispatch(Object(Magento\Cms\Controller\Index\Index\Interceptor), Object(Magento\Framework\App\Request\Http))
#8 web/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cms\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#9 web/htdocs/generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php(39): Magento\Cms\Controller\Index\Index\Interceptor->___callPlugins('dispatch', Array, Array)
#10 web/htdocs/vendor/magento/framework/App/FrontController.php(55): Magento\Cms\Controller\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#11 web/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#12 web/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#13 web/htdocs/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#14 web/htdocs/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#15 web/htdocs/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#16 web/htdocs/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#17 web/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#18 web/htdocs/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#19 web/htdocs/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#20 web/htdocs/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#21 web/htdocs/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()
#22 web/htdocs/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#23 {main}

Locating the error

php bin/magento setup:static-content:deploy es_ES --jobs=0 -f

Message in the deployment:

Compilation from source: > web/htdocs/vendor/magento/theme-frontend-blank/web/css/styles-m.less

variable @copyright__background-color is undefined in file web/htdocs/var/view_preprocessed/pub/static/frontend/Theme/MyTheme/en_US/Magento_Theme/css/source/_module.less in _module.less on line 263, column 36

261|

262| .copyright {

Compilation from source: > web/htdocs/vendor/magento/theme-frontend-blank/web/css/styles-l.less variable @copyright__background-color is undefined in file web/htdocs/var/view_preprocessed/pub/static/frontend/Theme/MyTheme/en_US/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

[Magento\Framework\Exception\FileSystemException] Cannot read > contents from file > "pub/static/frontend/Theme/MyTheme/en_US/css/styles-m.css" Warning!file_get_contents(pub/static/frontend/Theme/MyTheme/en_US/css/styles-m.css): failed to open stream: No such file or directory

It is obvious that the problem lies in the custom template.

I downloaded the full version of Magento 2.2.2. In this version, as expected, the styles-m.less and styles-l.less file do not exist in

vendor / magento / theme-frontend-blank / web / css path

But if they exist in the path:

/app/design/frontend/Magento/blank/web/css

I have uploaded both files to the specified path (vendor / magento / theme-frontend-blank / web / css /) and recompiled, but the error is the same.

Can someone give me directions on how to solve this problem?

Every time you have to do an update in Magento 2 I start to tremble.

1
  • did you find it's solution?
    – Abbas
    Commented Feb 1, 2020 at 2:02

2 Answers 2

0

Greetings and thanks for your response. My update has been through composer:

php bin/magento maintenance:enable su -c "composer require > magento/product-community-edition 2.2.2 --no-update"

su -c "rm -rf var/di var/generation var/view_preprocessed var/cache var/page_cache"

su -c "composer update"

chown -R owner:owner * chmod u+x bin/magento

php bin/magento cache:flush

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

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

php bin/magento indexer:reindex

chown -R conservera.es:conservera.es * find . -type d -exec chmod 770 {} \; && find . -type f -exec chmod 660 {} \;

chown -R owner:owner *

I've done it several times and the problem persists. About changing the widget data manually and converting it to JSON format instead of serializing the format, can you tell me how this operation is done?

Thank you.

0

This issue is related to widget. I believe in Magento 2.1.x widget code is stored in DB in serialize format.

But in Magento 2.2.x widget code is stored in DB in JSON format. Thats why this issue occurs.

To overcome this issue you have to use composer to upgrade the Magento. It will upgrade the DB entry as well. Or you have to change the widget data manually and convert it into JSON format instead of serialize format.

Hope this will resolve your issue.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.