无法使用 Drush 10 更新 Drupal 9 数据库和语言环境

Posted

技术标签:

【中文标题】无法使用 Drush 10 更新 Drupal 9 数据库和语言环境【英文标题】:Cannot update Drupal 9 db and locale with Drush 10 【发布时间】:2021-09-10 01:44:27 【问题描述】:

我在本地使用 drush 没有任何问题,但在我的主机上,语言环境和数据库更新出现错误。我检查了很多东西,什么都没有。奇怪的是,config import/export、sql:dump、drush status 等命令运行良好,并且有一个工作的 sql 连接。

完整输出:

php74 vendor/bin/drush locale:import pl ../translations/custom-translations.pl.po --type=customized --override=all --debug
 [preflight] Config paths: /home/pathtomywebsite/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /home/pathtomywebsite/web/drush/sites,/home/pathtomywebsite/drush/sites
 [preflight] Commandfile search paths: /home/pathtomywebsite/vendor/drush/drush/src
 [debug] Bootstrap further to find locale:import [0.07 sec, 8.75 MB]
 [debug] Trying to bootstrap as far as we can [0.07 sec, 8.75 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalRoot() [0.07 sec, 8.75 MB]
 [debug] Change working directory to /home/pathtomywebsite/web [0.07 sec, 8.75 MB]
 [debug] Initialized Drupal 9.2.0 root directory at /home/pathtomywebsite/web [0.07 sec, 8.75 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalSite() [0.07 sec, 9.08 MB]
 [debug] Initialized Drupal site default at sites/default [0.08 sec, 9.31 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.08 sec, 9.31 MB]
 [debug] Add service modifier [0.08 sec, 9.49 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalDatabase() [0.08 sec, 9.96 MB]
 [debug] Successfully connected to the Drupal database. [0.08 sec, 9.96 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalFull() [0.08 sec, 9.96 MB]
 [debug] Start bootstrap of the Drupal Kernel. [0.08 sec, 9.96 MB]
 [debug] Finished bootstrap of the Drupal Kernel. [0.15 sec, 16.23 MB]
 [debug] Add a command: twig-tweak:validate [0.2 sec, 21.52 MB]
 [debug] Add a command: twig-tweak:debug [0.2 sec, 21.52 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\config\ConfigCommands [0.22 sec, 23.4 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\config\ConfigExportCommands [0.22 sec, 23.43 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\config\ConfigImportCommands [0.22 sec, 23.44 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\BatchCommands [0.22 sec, 23.45 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\CliCommands [0.22 sec, 23.45 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\DrupalCommands [0.22 sec, 23.46 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\DeployHookCommands [0.22 sec, 23.47 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\EntityCommands [0.22 sec, 23.48 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\ImageCommands [0.22 sec, 23.49 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\JsonapiCommands [0.22 sec, 23.5 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\LanguageCommands [0.22 sec, 23.5 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\LocaleCommands [0.22 sec, 23.51 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\MessengerCommands [0.22 sec, 23.53 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\MigrateRunnerCommands [0.22 sec, 23.54 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\QueueCommands [0.22 sec, 23.59 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\RoleCommands [0.22 sec, 23.6 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\StateCommands [0.23 sec, 23.62 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\TwigCommands [0.23 sec, 23.64 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\UserCommands [0.23 sec, 23.64 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\ViewsCommands [0.23 sec, 23.69 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\WatchdogCommands [0.23 sec, 23.71 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\pm\PmCommands [0.23 sec, 23.74 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\pm\ThemeCommands [0.23 sec, 23.76 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommands [0.23 sec, 23.76 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommentsCommands [0.23 sec, 23.77 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeSessionsCommands [0.23 sec, 23.77 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserFieldsCommands [0.23 sec, 23.77 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserTableCommands [0.23 sec, 23.78 MB]
 [debug] Add a commandfile class: Drupal\entity_reference_revisions\Commands\EntityReferenceRevisionsCommands [0.23 sec, 23.78 MB]
 [debug] Add a commandfile class: Drupal\token\Commands\TokenCommands [0.23 sec, 23.79 MB]
 [debug] Add a commandfile class: Drupal\pathauto\Commands\PathautoCommands [0.23 sec, 23.79 MB]
 [debug] Done with bootstrap max in Application::bootstrapAndFind(): trying to find locale:import again. [0.23 sec, 23.8 MB]
 [debug] Starting bootstrap to none [0.23 sec, 23.91 MB]
 [debug] Drush bootstrap phase 0 [0.23 sec, 23.91 MB]
 [debug] Try to validate bootstrap phase 0 [0.24 sec, 23.91 MB]
 [info] Executing: /home/pathtomywebsite/vendor/drush/drush/drush batch-process 15 --uri=default --root=/home/pathtomywebsite/web [0.27 sec, 25.74 MB]
> 
>                                                                                
>   Command batch-process was not found. Drush was unable to query the database  
>   . As a result, many commands are unavailable. Re-run your command with --de  
>   bug to see relevant log messages.                                            
>                                                                                
> 

In ProcessBase.php line 155:
                              
  [InvalidArgumentException]  
  Output is empty.            
                              

Exception trace:
  at /home/pathtomywebsite/vendor/consolidation/site-process/src/ProcessBase.php:155
 Consolidation\SiteProcess\ProcessBase->getOutputAsJson() at /home/pathtomywebsite/vendor/drush/drush/includes/batch.inc:157
 _drush_backend_batch_process() at /home/pathtomywebsite/vendor/drush/drush/includes/batch.inc:80
 drush_backend_batch_process() at /home/pathtomywebsite/vendor/drush/drush/src/Drupal/Commands/core/LocaleCommands.php:268
 Drush\Drupal\Commands\core\LocaleCommands->import() at n/a:n/a
 call_user_func_array() at /home/pathtomywebsite/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
 Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /home/pathtomywebsite/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
 Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /home/pathtomywebsite/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
 Consolidation\AnnotatedCommand\CommandProcessor->process() at /home/pathtomywebsite/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:311
 Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /home/pathtomywebsite/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /home/pathtomywebsite/vendor/symfony/console/Application.php:1027
 Symfony\Component\Console\Application->doRunCommand() at /home/pathtomywebsite/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /home/pathtomywebsite/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /home/pathtomywebsite/vendor/drush/drush/src/Runtime/Runtime.php:118
 Drush\Runtime\Runtime->doRun() at /home/pathtomywebsite/vendor/drush/drush/src/Runtime/Runtime.php:48
 Drush\Runtime\Runtime->run() at /home/pathtomywebsite/vendor/drush/drush/drush.php:72
 require() at /home/pathtomywebsite/vendor/drush/drush/drush:4

冲刺状态:

php74 vendor/bin/drush status
 Drupal version   : 9.2.0                                                              
 Site URI         : http://default                                                     
 DB driver        : mysql                                                              
 DB hostname      : localhost                                                          
 DB port          : 3306                                                               
 DB username      : ****                                                     
 DB name          : ****                                                     
 Database         : Connected                                                          
 Drupal bootstrap : Successful                                                         
 Default theme    : ttp                                                                
 Admin theme      : seven                                                              
 PHP binary       : /usr/local/php7.4/bin/php                                          
 PHP config       : /usr/local/php7.4/php.ini                                          
 PHP OS           : Linux                                                              
 Drush script     : /home/pathtomywebsite/vendor/drush/drush/drush     
 Drush version    : 10.5.0                                                             
 Drush temp       : /tmp                                                               
 Drush configs    : /home/pathtomywebsite/vendor/drush/drush/drush.yml 
 Install profile  : standard                                                           
 Drupal root      : /home/pathtomywebsite/web                          
 Site path        : sites/default                                                      
 Files, Public    : sites/default/files                                                
 Files, Temp      : /tmp

sql:connection 返回 mysql 的工作字符串。我卡住了,也许有人有类似的问题?

updatedb 命令的调试输出:

php74 vendor/bin/drush updatedb

In Process.php line 266:
                                                                                                                                                                                           
  The command "/home/pathtomywebsite/vendor/drush/drush/drush updatedb:status --no-entity-updates --uri=default --root=/home/pathtomywebsite/web" failed.  
                                                                                                                                                                                           
  Exit Code: 1(General error)                                                                                                                                                              
                                                                                                                                                                                           
  Working directory:                                                                                                                                                                       
                                                                                                                                                                                           
  Output:                                                                                                                                                                                  
  ================                                                                                                                                                                         
                                                                                                                                                                                           
                                                                                                                                                                                           
  Error Output:                                                                                                                                                                            
  ================                                                                                                                                                                         
                                                                                                                                                                                           
  In BootstrapHook.php line 32:                                                                                                                                                            
                                                                                                                                                                                           
    Bootstrap failed. Run your command with -vvv for more information.                                                                                                                     
                                                                                                                                                                                           

user@server:~/somepath$ php74 vendor/bin/drush updatedb -vvv
 [preflight] Config paths: /home/pathtomywebsite/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /home/pathtomywebsite/web/drush/sites,/home/pathtomywebsite/drush/sites
 [preflight] Commandfile search paths: /home/pathtomywebsite/vendor/drush/drush/src
 [debug] Starting bootstrap to full [0.06 sec, 8.78 MB]
 [debug] Drush bootstrap phase 5 [0.06 sec, 8.78 MB]
 [debug] Try to validate bootstrap phase 5 [0.06 sec, 8.78 MB]
 [debug] Try to validate bootstrap phase 5 [0.06 sec, 8.78 MB]
 [debug] Try to bootstrap at phase 5 [0.06 sec, 8.78 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalRoot() [0.06 sec, 8.78 MB]
 [debug] Change working directory to /home/pathtomywebsite/web [0.06 sec, 8.78 MB]
 [debug] Initialized Drupal 9.2.0 root directory at /home/pathtomywebsite/web [0.06 sec, 8.78 MB]
 [debug] Try to validate bootstrap phase 5 [0.06 sec, 8.78 MB]
 [debug] Try to bootstrap at phase 5 [0.06 sec, 9.17 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalSite() [0.06 sec, 9.17 MB]
 [debug] Initialized Drupal site default at sites/default [0.06 sec, 9.34 MB]
 [debug] Try to validate bootstrap phase 5 [0.06 sec, 9.34 MB]
 [debug] Try to bootstrap at phase 5 [0.06 sec, 9.34 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.06 sec, 9.34 MB]
 [debug] Add service modifier [0.07 sec, 9.55 MB]
 [debug] Try to validate bootstrap phase 5 [0.07 sec, 9.55 MB]
 [debug] Try to bootstrap at phase 5 [0.07 sec, 10.06 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalDatabase() [0.07 sec, 10.06 MB]
 [debug] Successfully connected to the Drupal database. [0.07 sec, 10.06 MB]
 [debug] Try to validate bootstrap phase 5 [0.07 sec, 10.06 MB]
 [debug] Try to bootstrap at phase 5 [0.07 sec, 10.06 MB]
 [debug] Drush bootstrap phase: bootstrapDrupalFull() [0.07 sec, 10.06 MB]
 [debug] Start bootstrap of the Drupal Kernel. [0.07 sec, 10.06 MB]
 [info] entity_reference_revisions should have an extra.drush.services section in its composer.json. See http://docs.drush.org/en/10.x/commands/#specifying-the-services-file. [0.1 sec, 12.42 MB]
 [debug] Found drush.services.yml for token Drush commands [0.1 sec, 12.57 MB]
 [info] twig_tweak should have an extra.drush.services section in its composer.json. See http://docs.drush.org/en/10.x/commands/#specifying-the-services-file. [0.1 sec, 12.57 MB]
 [debug] Found drush.services.yml for pathauto Drush commands [0.1 sec, 12.57 MB]
 [debug] Get container builder [0.1 sec, 12.59 MB]
 [debug] Service modifier alter. [0.11 sec, 12.69 MB]
 [debug] process drush.console.services console.command [0.17 sec, 17.37 MB]
 [debug] Found tagged service twig_tweak.validate [0.17 sec, 17.37 MB]
 [debug] Found tagged service twig_tweak.debug [0.17 sec, 17.37 MB]
 [debug] process drush.command.services drush.command [0.17 sec, 17.37 MB]
 [debug] Found tagged service config.commands [0.17 sec, 17.37 MB]
 [debug] Found tagged service config.export.commands [0.17 sec, 17.37 MB]
 [debug] Found tagged service config.import.commands [0.17 sec, 17.37 MB]
 [debug] Found tagged service batch.commands [0.17 sec, 17.37 MB]
 [debug] Found tagged service cli.commands [0.17 sec, 17.37 MB]
 [debug] Found tagged service drupal.commands [0.17 sec, 17.37 MB]
 [debug] Found tagged service deploy_hook.commands [0.17 sec, 17.37 MB]
 [debug] Found tagged service entity.commands [0.17 sec, 17.37 MB]
 [debug] Found tagged service image.commands [0.17 sec, 17.37 MB]
 [debug] Found tagged service jsonapi.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service language.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service locale.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service messenger.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service migrate_runner.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service queue.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service role.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service state.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service twig.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service user.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service views.commands [0.17 sec, 17.38 MB]
 [debug] Found tagged service watchdog.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service pm.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service theme.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service sanitize.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service sanitize.comments.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service sanitize.sessions.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service sanitize.userfields.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service sanitize.usertable.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service entity_reference_revisions.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service token.commands [0.17 sec, 17.39 MB]
 [debug] Found tagged service pathauto.commands [0.17 sec, 17.39 MB]
 [debug] process drush.command_info_alterer.services drush.command_info_alterer [0.17 sec, 17.39 MB]
 [debug] process drush.generator.services drush.generator [0.17 sec, 17.39 MB]
 [debug] Finished bootstrap of the Drupal Kernel. [0.3 sec, 26.24 MB]
 [debug] Add a command: twig-tweak:validate [0.4 sec, 36.8 MB]
 [debug] Add a command: twig-tweak:debug [0.4 sec, 36.8 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\config\ConfigCommands [0.42 sec, 38.48 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\config\ConfigExportCommands [0.42 sec, 38.52 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\config\ConfigImportCommands [0.42 sec, 38.52 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\BatchCommands [0.42 sec, 38.53 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\CliCommands [0.42 sec, 38.54 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\DrupalCommands [0.42 sec, 38.54 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\DeployHookCommands [0.42 sec, 38.56 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\EntityCommands [0.42 sec, 38.56 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\ImageCommands [0.42 sec, 38.57 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\JsonapiCommands [0.42 sec, 38.58 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\LanguageCommands [0.42 sec, 38.59 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\LocaleCommands [0.42 sec, 38.6 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\MessengerCommands [0.42 sec, 38.62 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\MigrateRunnerCommands [0.42 sec, 38.62 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\QueueCommands [0.43 sec, 38.67 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\RoleCommands [0.43 sec, 38.68 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\StateCommands [0.43 sec, 38.71 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\TwigCommands [0.43 sec, 38.72 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\UserCommands [0.43 sec, 38.73 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\ViewsCommands [0.43 sec, 38.77 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\core\WatchdogCommands [0.43 sec, 38.8 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\pm\PmCommands [0.43 sec, 38.83 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\pm\ThemeCommands [0.43 sec, 38.84 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommands [0.43 sec, 38.85 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeCommentsCommands [0.43 sec, 38.85 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeSessionsCommands [0.43 sec, 38.85 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserFieldsCommands [0.43 sec, 38.86 MB]
 [debug] Add a commandfile class: Drush\Drupal\Commands\sql\SanitizeUserTableCommands [0.43 sec, 38.86 MB]
 [debug] Add a commandfile class: Drupal\entity_reference_revisions\Commands\EntityReferenceRevisionsCommands [0.43 sec, 38.87 MB]
 [debug] Add a commandfile class: Drupal\token\Commands\TokenCommands [0.43 sec, 38.87 MB]
 [debug] Add a commandfile class: Drupal\pathauto\Commands\PathautoCommands [0.43 sec, 38.87 MB]
 [info] Executing: /home/pathtomywebsite/vendor/drush/drush/drush updatedb:status --no-entity-updates --uri=default --root=/home/pathtomywebsite/web [0.56 sec, 41.87 MB]

In Process.php line 266:
                                                                                                                                                                                           
  [Symfony\Component\Process\Exception\ProcessFailedException]                                                                                                                             
  The command "/home/pathtomywebsite/vendor/drush/drush/drush updatedb:status --no-entity-updates --uri=default --root=/home/pathtomywebsite/web" failed.  
                                                                                                                                                                                           
  Exit Code: 1(General error)                                                                                                                                                              
                                                                                                                                                                                           
  Working directory:                                                                                                                                                                       
                                                                                                                                                                                           
  Output:                                                                                                                                                                                  
  ================                                                                                                                                                                         
                                                                                                                                                                                           
                                                                                                                                                                                           
  Error Output:                                                                                                                                                                            
  ================                                                                                                                                                                         
                                                                                                                                                                                           
  In BootstrapHook.php line 32:                                                                                                                                                            
                                                                                                                                                                                           
    Bootstrap failed. Run your command with -vvv for more information.                                                                                                                     
                                                                                                                                                                                           

Exception trace:
  at /home/pathtomywebsite/vendor/symfony/process/Process.php:266
 Symfony\Component\Process\Process->mustRun() at /home/pathtomywebsite/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php:67
 Drush\Commands\core\UpdateDBCommands->updatedb() at n/a:n/a
 call_user_func_array() at /home/pathtomywebsite/vendor/consolidation/annotated-command/src/CommandProcessor.php:257
 Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /home/pathtomywebsite/vendor/consolidation/annotated-command/src/CommandProcessor.php:212
 Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /home/pathtomywebsite/vendor/consolidation/annotated-command/src/CommandProcessor.php:176
 Consolidation\AnnotatedCommand\CommandProcessor->process() at /home/pathtomywebsite/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:311
 Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /home/pathtomywebsite/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /home/pathtomywebsite/vendor/symfony/console/Application.php:1027
 Symfony\Component\Console\Application->doRunCommand() at /home/pathtomywebsite/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /home/pathtomywebsite/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /home/pathtomywebsite/vendor/drush/drush/src/Runtime/Runtime.php:118
 Drush\Runtime\Runtime->doRun() at /home/pathtomywebsite/vendor/drush/drush/src/Runtime/Runtime.php:48
 Drush\Runtime\Runtime->run() at /home/pathtomywebsite/vendor/drush/drush/drush.php:72
 require() at /home/pathtomywebsite/vendor/drush/drush/drush:4

【问题讨论】:

【参考方案1】:

在我的情况下,问题在于我的主机上的 php 版本。要使用 7.4 运行,我必须使用 php74 cli:

**php74** vendor/bin/drush updatedb

Drush 不适用于自定义 php 二进制名称。即使我在 drush classess 中修改了这条路径,仍然出现同样的错误。已知错误在 drush github 问题上发布了几次。

【讨论】:

【参考方案2】:

在使用更新的 PHP 版本更新 docker 容器后,我遇到了同样的问题。 我能够通过比较 php.ini 来追踪问题。 区别在于variables_order 设置。

在终端中运行以下命令来检查值:

php -i | grep variables_order

在我的例子中,输出是:

variables_order => GPCS => GPCS

改成EGPCS后,脚本运行成功。

要更新值,请在 php.ini 文件中将 variables_order 设置为 "EGPCS"。 可以在终端运行获取配置文件的路径:

php --ini

它将列出所有包含的配置文件。使用顶部带有标签Loaded Configuration File 的那个,配置必须在那里。在我的情况下是:

Loaded Configuration File:         /usr/local/etc/php/php.ini

找到variables_order 并确保您的配置如下:

variables_order = "EGPCS"

【讨论】:

感谢您的回答。就我而言,这是一个不同的问题,我稍后会写出来,但它仍然对其他人有帮助

以上是关于无法使用 Drush 10 更新 Drupal 9 数据库和语言环境的主要内容,如果未能解决你的问题,请参考以下文章

drupal 8 如何安装 drush 9

将 Drush 8 升级到 9 站点别名不起作用

无法使用Drush导出Drupal archive-dump

sh Drush在其自己的文件夹中更新Drupal Sites的目录

找不到包裹 drush/drush

如何修复 drupal8 的错误“drush - command not found”?