Skip to content

'Command returned non-zero exit code:...' Unable to set deploy:mode:set production #9202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fideliocc opened this issue Apr 11, 2017 · 12 comments

Comments

@fideliocc
Copy link

When I try to switch from default to production mode with:

./bin php magento deploy:mode:set production

i got this result:

/bin# php magento deploy:mode:set production
Enabled maintenance mode
Starting compilation
Compilation was started.
%message% 0/7 [>---------------------------]   0% 1 sec 38.0 MiB%message% 0/7 [>---------------------------]   0% 1 sec 38.0 MiBProxies code generation... 0/7 [>---------------------------]   0% 1 sec 38.0 MiB
Proxies code generation... 1/7 [====>-----------------------]  14% 1 sec 42.0 MiB
Repositories code generation... 1/7 [====>-----------------------]  14% 1 sec 42.0 MiB
Repositories code generation... 2/7 [========>-------------------]  28% 7 secs 136.0 MiB
Service data attributes generation... 2/7 [========>-------------------]  28% 7 secs 136.0 MiB
Service data attributes generation... 3/7 [============>---------------]  42% 7 secs 136.0 MiB
Application code generator... 3/7 [============>---------------]  42% 7 secs 136.0 MiB
Application code generator... 4/7 [================>-----------]  57% 18 secs 156.0 MiB
Interceptors generation... 4/7 [================>-----------]  57% 18 secs 156.0 MiB
Interceptors generation... 5/7 [====================>-------]  71% 33 secs 174.0 MiB
Area configuration aggregation... 5/7 [====================>-------]  71% 33 secs 174.0 MiB
Area configuration aggregation... 6/7 [========================>---]  85% 47 secs 248.0 MiB
Interception cache generation... 6/7 [========================>---]  85% 47 secs 248.0 MiB
Interception cache generation... 7/7 [============================] 100% 56 secs 248.0 MiB
Generated code and dependency injection configuration successfully.
Compilation complete
Starting deployment of static content
Something went wrong while deploying static content. See the error log for details.
Command returned non-zero exit code:
`/usr/bin/php7.0 -f /var/www/html/bin/magento setup:static-content:deploy es_MX en_US`

Then the site is down and still in default mode.

Thanks in advance.

@adragus-inviqa
Copy link
Contributor

Hi. Why do you think this is an M2 bug?

They'll come in shortly, telling you that you should ask on https://magento.stackexchange.com/ instead, so I'm saving them the trouble. Or you.

Anyway, you don't provide enough info. We're more interested in Something went wrong while deploying static content. See the error log for details. Can we see the error log for details? How can we help you otherwise?

@fideliocc
Copy link
Author

fideliocc commented Apr 11, 2017

Currently I only can switch from default to production mode with ./bin php magento deploy:mode:set production --skip-compilation.. Error persists if not.

Then I manage the permissions at /pub and /var folders, removevar/di folder and deploy again with ./bin php magento setup:static-content:deploy es_MX. It's important to say that I manage memory_limit in the php.ini file too. The site works but shows wrong styles and distribution. Is not an error log number generated, so I can't locate the report at var/report. Should I find in another directory?

Thanks for help.

@fideliocc
Copy link
Author

fideliocc commented Apr 11, 2017

@adragus-inviqa I did the process again following steps from here: http://magento.stackexchange.com/questions/106436/merged-js-and-css-do-not-work-when-production-mode

bin/magento setup:upgrade

bin/magento indexer:reindex

bin/magento deploy:mode:set production -s (or --skip-compilation)

bin/magento setup:di:compile (Here was the secret, to run the di:compile after production)

bin/magento setup:static-content:deploy es_MX (in my case)

Then I deployed with ./ bin php magento setup:static-content:deploy es_MX

Requested languages: es_MX
Requested areas: frontend, adminhtml
Requested themes: Magento/blank, Magento/luma, Zozothemes/varmo_rtl, Zozothemes/varmo, Magento/backend
=== frontend -> Magento/blank -> es_MX ===
=== frontend -> Magento/luma -> es_MX ===
=== frontend -> Zozothemes/varmo_rtl -> es_MX ===
=== frontend -> Zozothemes/varmo -> es_MX ===
......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Compilation from source: /var/www/html/vendor/magento/theme-frontend-blank/web/css/styles-m.less

Compilation from source: 
frontend/Zozothemes/varmo_rtl/es_MX/css/styles-m.less
variable @toolbar-background is undefined in file /var/www/html/var/view_preprocessed/css/frontend/Zozothemes/varmo_rtl/es_MX/Magento_LayeredNavigation/css/source/_module.less in _module.less on line 273, column 38
271|                 left: 0;
272|                 height: 50px;
273|                 .lib-css(background, @toolbar-background);
274|                 z-index: 1;
275|                 line-height: 32px;
 in _responsive.less

....

Compilation from source: /var/www/html/vendor/magento/theme-frontend-blank/web/css/styles-m.less

Compilation from source: 
frontend/Zozothemes/varmo/es_MX/css/styles-m.less
variable @toolbar-background is undefined in file /var/www/html/var/view_preprocessed/css/frontend/Zozothemes/varmo/es_MX/Magento_LayeredNavigation/css/source/_module.less in _module.less on line 273, column 38
271|                 left: 0;
272|                 height: 50px;
273|                 .lib-css(background, @toolbar-background);
274|                 z-index: 1;
275|                 line-height: 32px;
 in _responsive.less

.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Successful: 2118 files; errors: 0
---

....................................=== adminhtml -> Magento/backend -> es_MX ===
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Successful: 2193 files; errors: 0
---

.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Successful: 2257 files; errors: 1
---

........
Successful: 2255 files; errors: 1
---

..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Successful: 2021 files; errors: 0
---

=== Minify templates ===

Successful: 942 files modified
---


This is the compilation results. When I reload website I have the following message in browser:

There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 1041370881471

Below the content of "1041370881471" file found at /var/www/html/var/report:

a:4:{i:0;s:211:"Warning: file_put_contents(/var/www/html/var/cache//mage-tags/mage---792_COMPILED_CONFIG): failed to open stream: Permission denied in /var/www/html/vendor/colinmollenhour/cache-backend-file/File.php on line 663";i:1;s:3159:"#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'file_put_conten...', '/var/www/html/v...', 663, Array)
#1 /var/www/html/vendor/colinmollenhour/cache-backend-file/File.php(663): file_put_contents('/var/www/html/v...', '792_GLOBAL_FRON...', 10)
#2 /var/www/html/vendor/colinmollenhour/cache-backend-file/File.php(179): Cm_Cache_Backend_File->_updateIdsTags(Array, Array, 'merge')
#3 /var/www/html/vendor/magento/zendframework1/library/Zend/Cache/Core.php(390): Cm_Cache_Backend_File->save('a:3:{i:0;a:130:...', '792_GLOBAL_FRON...', Array, NULL)
#4 /var/www/html/vendor/magento/framework/Cache/Core.php(74): Zend_Cache_Core->save('a:3:{i:0;a:130:...', '792_GLOBAL_FRON...', Array, NULL, 8)
#5 /var/www/html/vendor/magento/framework/Cache/Frontend/Adapter/Zend.php(47): Magento\Framework\Cache\Core->save('a:3:{i:0;a:130:...', 'GLOBAL|FRONTEND...', Array, NULL)
#6 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(75): Magento\Framework\Cache\Frontend\Adapter\Zend->save('a:3:{i:0;a:130:...', 'global|frontend...', Array, NULL)
#7 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/TagScope.php(49): Magento\Framework\Cache\Frontend\Decorator\Bare->save('a:3:{i:0;a:130:...', 'global|frontend...', Array, NULL)
#8 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(75): Magento\Framework\Cache\Frontend\Decorator\TagScope->save('a:3:{i:0;a:130:...', 'global|frontend...', Array, NULL)
#9 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(75): Magento\Framework\Cache\Frontend\Decorator\Bare->save('a:3:{i:0;a:130:...', 'global|frontend...', Array, NULL)
#10 /var/www/html/vendor/magento/framework/App/Cache/Type/AccessProxy.php(85): Magento\Framework\Cache\Frontend\Decorator\Bare->save('a:3:{i:0;a:130:...', 'global|frontend...', Array, NULL)
#11 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(75): Magento\Framework\App\Cache\Type\AccessProxy->save('a:3:{i:0;a:130:...', 'global|frontend...', Array, NULL)
#12 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/TagScope.php(49): Magento\Framework\Cache\Frontend\Decorator\Bare->save('a:3:{i:0;a:130:...', 'global|frontend...', Array, NULL)
#13 /var/www/html/vendor/magento/framework/Interception/PluginList/PluginList.php(305): Magento\Framework\Cache\Frontend\Decorator\TagScope->save('a:3:{i:0;a:130:...', 'global|frontend...')
#14 /var/www/html/vendor/magento/framework/Interception/PluginList/PluginList.php(248): Magento\Framework\Interception\PluginList\PluginList->_loadScopedData()
#15 /var/www/html/var/generation/Magento/Framework/App/FrontController/Interceptor.php(22): Magento\Framework\Interception\PluginList\PluginList->getNext('Magento\\Framewo...', 'dispatch')
#16 /var/www/html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#17 /var/www/html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#18 /var/www/html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#19 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";}

@nntoan
Copy link
Contributor

nntoan commented Apr 12, 2017

@fideliocc Make sure you set enough memory_limit in php.ini for PHP cli.

@fideliocc
Copy link
Author

fideliocc commented Apr 12, 2017

@nntoan

php.ini values are:

post_max_size = 1024M
upload_max_filesize = 1024M
memory_limit = 3G
max_execution_time = 500

@nntoan
Copy link
Contributor

nntoan commented Apr 12, 2017

@fideliocc As your last log, seems your "var" directory not set to correct permission.

file_put_contents(/var/www/html/var/cache//mage-tags/mage---792_COMPILED_CONFIG) failed to open stream: Permission denied in /var/www/html/vendor/colinmollenhour/cache-backend-file/File.php on 

@korostii
Copy link
Contributor

They'll come in shortly, telling you that you should ask on https://magento.stackexchange.com/ instead

And the funny part is that "They" have a point. Having the application produce an error after you plug in some 3rd party theme doesn't mean the application itself has a bug. Sometimes, it is just signalling that your custom code is incompatible and needs to be fixed or updated or replaced.
Please do read the errors first, and please do understand that is no helpdesk. This is the place to report actual bugs. Oh and btw "They" might also send you to the Community Forums.

(Here was the secret, to run the di:compile after production)

That ain't no secret if you read the documentation first, which you probably should.

So here goes the trouble: If you are looking for some additional help or an advice regarding setup or development please refer to the Community Forums or the Magento Stack Exchange.
The GitHub issue tracker is intended for tracking technical issues (read: "bugs") only.
The issues which cannot be consistently reproduced on a clean installation of Magento 2 CE installed on a sufficient server environment aren't likely to get resolved in here.

@fideliocc
Copy link
Author

Now problem is solved, thanks for the support. @korostii It was missed files from theme module. I'll be in the right forum next time. Thanks for suggestions.

@choukalos
Copy link

Hi @fideliocc - can you close the issue then? Thanks!

@rustsol
Copy link

rustsol commented Aug 25, 2017

It seems like issue is still there while enabling the production mode. Mentioned stuffs in this thread are already configured my my nginx server but still its not working.

@evagabond
Copy link

@yogisfunda - I am running nginx too. You will have to change the values mentioned by @fideliocc at: #9202 (comment) in your php.ini file which should be located at /etc/phpx/php.ini, where 'x' stands for your php version such as 7.2, 7.3 etc

@ray-moncada
Copy link

Thank you, this helped alot, and saved time.

magento-devops-reposync-svc pushed a commit that referenced this issue Sep 11, 2024
…-23-2024

[Support Tier-4-Kings glo02433] 08.23.2024 Regular delivery of bugfixes and improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants