【问题标题】:Cannot execute composer update无法执行作曲家更新
【发布时间】:2021-12-19 16:57:12
【问题描述】:

我正在尝试在 docker 容器文件夹(不在容器内)中执行“composer update”,但出现此错误

    In ConnectionFactory.php line 79:
                                                                               
  An exception occured while establishing a connection to figure out your pla  
  tform version.                                                               
  You can circumvent this by setting a 'server_version' configuration value    
                                                                               
  For further information have a look at:                                      
  https://github.com/doctrine/DoctrineBundle/issues/673                        
                                                                               

In AbstractMySQLDriver.php line 112:
                                                                               
  An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddr  
  esses: getaddrinfo failed: Temporary failure in name resolution              
                                                                               

In Exception.php line 18:
                                                                               
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Tempor  
  ary failure in name resolution                                               
                                                                               

In PDOConnection.php line 40:
                                                                               
  SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Tempor  
  ary failure in name resolution                                               
                                                                               

In PDOConnection.php line 40:
                                                                               
  PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Temporary  
   failure in name resolution                                                  
                                                                               

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception

                                                                                   
  [RuntimeException]                                                               
  An error occurred when executing the "'cache:clear --no-warmup'" command:        
                                                                                   
                                                                                   
                                                                                   
                                                                                   
  In ConnectionFactory.php line 79:                                                
                                                                                   
    An exception occured while establishing a connection to figure out your pla    
    tform version.                                                                 
    You can circumvent this by setting a 'server_version' configuration value      
                                                                                   
    For further information have a look at:                                        
    https://github.com/doctrine/DoctrineBundle/issues/673                          
                                                                                   
                                                                                   
  In AbstractMySQLDriver.php line 112:                                             
                                                                                   
    An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddr    
    esses: getaddrinfo failed: Temporary failure in name resolution                
                                                                                   
                                                                                   
  In Exception.php line 18:                                                        
                                                                                   
    SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Tempor    
    ary failure in name resolution                                                 
                                                                                   
                                                                                   
  In PDOConnection.php line 40:                                                    
                                                                                   
    SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Tempor    
    ary failure in name resolution                                                 
                                                                                   
                                                                                   
  In PDOConnection.php line 40:                                                    
                                                                                   
    PDO::__construct(): php_network_getaddresses: getaddrinfo failed: Temporary    
     failure in name resolution

我不知道如何解决它,我记得我执行了 composer install outise docker 容器但现在我无法执行 composer update ,我收到了我在问题中描述的错误

【问题讨论】:

  • 您的作曲家文件可能有一个 scripts 部分,其中包含一个 post-update-cmd 命令,这太吓人了。不幸的是,调试可能特定于您的安装。但是,您可以尝试运行composer up --no-scripts 来绕过它。

标签: php docker composer-php


【解决方案1】:

似乎当 composer update 运行时它需要连接到数据库。而且您的应用无法建立与 MySql 数据库的连接

【讨论】:

  • 请分享更多细节。对我来说,这看起来确实像一条评论,没有为给定问题提供任何解决方案
  • 作曲家更新需要数据库来存储数据。我不知道为什么它无法连接到数据库。解决方案是找出连接被拒绝的原因。这可能是由于 RDBMS 未运行。可能是错误的 host:port 给连接对象。
  • 请通过编辑为您的答案添加所有说明
  • 问题在于 composer 在 docker 容器外执行
猜你喜欢
  • 2021-12-16
  • 1970-01-01
  • 1970-01-01
  • 2016-11-19
  • 2013-12-04
  • 2015-06-14
  • 1970-01-01
  • 2015-12-01
  • 2015-09-11
相关资源
最近更新 更多