2

我正在关注 Laravel 6.x 到 Laravel 7.x 升级文档并进行了必要的更改。但它失败并显示以下错误。在运行composer update时没有第 3 方包。然后我安装了一些其他软件包,然后尝试再次更新并陷入此错误。

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Symfony\Component\Process\Process::__construct() must be of the type array, string given, called in phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php on line 65 and defined in /var/www/html/laravel/laravel-starter/vendor/symfony/process/Process.php:140
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php(65): Symfony\Component\Process\Process->__construct(''/usr/bin/php7....', NULL, NULL, NULL, 300)
#1 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(245): Composer\Util\ProcessExecutor->execute(''/usr/bin/php7....')
#2 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#3 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(312): Composer\EventDispatcher\EventDispatcher->dispatchScript('post-autoload-d...', true, Array, Array)
#4 phar:///usr/local/bin in /var/www/html/laravel/laravel-starter/vendor/symfony/process/Process.php on line 140

Fatal error: Uncaught TypeError: Argument 1 passed to Symfony\Component\Process\Process::__construct() must be of the type array, string given, called in phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php on line 65 and defined in /var/www/html/laravel/laravel-starter/vendor/symfony/process/Process.php:140
Stack trace:
#0 phar:///usr/local/bin/composer/src/Composer/Util/ProcessExecutor.php(65): Symfony\Component\Process\Process->__construct(''/usr/bin/php7....', NULL, NULL, NULL, 300)
#1 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(245): Composer\Util\ProcessExecutor->execute(''/usr/bin/php7....')
#2 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(96): Composer\EventDispatcher\EventDispatcher->doDispatch(Object(Composer\Script\Event))
#3 phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php(312): Composer\EventDispatcher\EventDispatcher->dispatchScript('post-autoload-d...', true, Array, Array)
#4 phar:///usr/local/bin in /var/www/html/laravel/laravel-starter/vendor/symfony/process/Process.php on line 140

该项目的源代码位于:https ://github.com/nasirkhan/laravel-starter/tree/v7

4

2 回答 2

1

确保您所有的 symfony 依赖项至少为 5.0,并且您的作曲家通过运行composer self-update.

于 2020-03-08T06:49:09.970 回答
1

Laravel 7 将 Symfony 从 4 升级到 5 并且Process语法发生了变化:

前:

$process = new Process('ls -l');

后:

$process = new Process(array('ls', '-l'));

您需要将代码调整为新语法。

更多信息在这里:https ://github.com/symfony/symfony/blob/5.x/UPGRADE-5.0.md#process

于 2021-01-02T18:23:01.920 回答