deployer icon indicating copy to clipboard operation
deployer copied to clipboard

Error deploying - PHP Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator()

Open gravataLonga opened this issue 3 years ago • 2 comments

  • Deployer version: ^6.8
  • PHP Version Local: 7.4
  • PHP Version Remove: 8.1
  • Deployment OS Local: OSx
  • Deployment OS Remote: Ubuntu
<?php
namespace Deployer;

require 'recipe/common.php';

// Project name
set('application', 'xxxxxxx');

// Project repository
set('repository', '[email protected]:xxxxxxxxxxx.git');

// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true); 

// Shared files/dirs between deploys 
set('shared_files', []);
set('shared_dirs', []);

// Writable dirs by web server 
set('writable_dirs', []);


// Hosts

host('xxxxxxxxx')
    ->user('xxxxxxxx')
    ->set('deploy_path', '~/{{application}}');
    

// Tasks

desc('Deploy your project');
task('deploy', [
    'deploy:info',
    'deploy:prepare',
    'deploy:lock',
    'deploy:release',
    'deploy:update_code',
    'deploy:shared',
    'deploy:writable',
    'deploy:vendors',
    'deploy:clear_paths',
    'deploy:symlink',
    'deploy:unlock',
    'cleanup',
    'success'
]);

// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');

```. 

Output:  

```php
> dep deploy
✈︎ Deploying main on xxxxxxx
✔ Executing task deploy:prepare
✔ Executing task deploy:lock
✔ Executing task deploy:release
➤ Executing task deploy:update_code
Cloning into '/home/xxxxxxxxxx/releases/1'...
remote: Enumerating objects: 2245, done.
remote: Total 2245 (delta 0), reused 0 (delta 0), pack-reused 2245
Receiving objects: 100% (2245/2245), 6.03 MiB | 7.36 MiB/s, done.
Resolving deltas: 100% (1574/1574), done.
Connection to xxxxxxx closed.
✔ Ok
✔ Executing task deploy:shared
✔ Executing task deploy:writable
➤ Executing task deploy:vendors
✔ Executing task deploy:failed
✔ Executing task deploy:unlock

In Client.php line 103:
                                                                                                                                                                                                                   
  The command "cd ~/xxxxxxx/releases/1 && /usr/bin/composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader --no-suggest" failed.                           
                                                                                                                                                                                                                   
  Exit Code: 1 (General error)                                                                                                                                                                                     
                                                                                                                                                                                                                   
  Host Name: xxxxxxxxxx                                                                                                                                                                                      
                                                                                                                                                                                                                   
  ================                                                                                                                                                                                                 
  PHP Deprecated:  Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attri  
  bute should be used to temporarily suppress the notice in phar:///usr/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112                                                                       
  Composer could not find a composer.json file in /home/xxxxxxxxxxxxx/releases/1                                                                                                                   
  To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section                                                                               
                                                                                                                                                                                                                   

deploy [-p|--parallel] [-l|--limit LIMIT] [--no-hooks] [--log LOG] [--roles ROLES] [--hosts HOSTS] [-o|--option OPTION] [--] [<stage>]

gravataLonga avatar Jun 07 '22 17:06 gravataLonga

I fixed this error removing Composer old version and install the new version, in my case I saw the error when I ran composer.

henryq30 avatar Jul 11 '22 13:07 henryq30

  1. cd~

  2. sudo apt-get remove composer

  3. curl -sS https://getcomposer.org/installer -o composer-setup.php

  4. sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

  5. verify the composer installation with the command: composer

henryq30 avatar Jul 11 '22 13:07 henryq30

Sorry I didn't reply but yeah, I've fixed with update composer.

gravataLonga avatar Sep 11 '22 08:09 gravataLonga