我在一台装有 Apple 的 M1 处理器的机器上克隆了一个现有的应用程序。然后使用以下命令将其带入(Ref)。
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/opt \
-w /opt \
laravelsail/php74-composer:latest \
composer install --ignore-platform-reqs
然后也尝试了:
docker run --rm --platform linux/amd64 \
-u "$(id -u):$(id -g)" \
-v $(pwd):/opt \
-w /opt \
laravelsail/php74-composer:latest \
composer install --ignore-platform-reqs
这两个命令都失败并显示相同的消息:
> @php artisan package:discover --ansi
Doctrine\DBAL\Driver\PDO\Exception
could not find driver
at vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18
14▕ final class Exception extends PDOException
15▕ {
16▕ public static function new(\PDOException $exception): self
17▕ {
➜ 18▕ return new self($exception);
19▕ }
20▕ }
21▕
+1 vendor frames
2 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(App\Providers\AppServiceProvider))
+18 vendor frames
21 app/Providers/AppServiceProvider.php:94
Illuminate\Support\Facades\Facade::__callStatic("listen")
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
但是,我可以php artisan package:discover --ansi
从主机和容器内部执行命令:
./vendor/bin/sail artisan package:discover --ansi
["select * from `data_types`",[],79.14]
Discovered Package: arrilot/laravel-widgets
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: fruitcake/laravel-cors
Discovered Package: intervention/image
Discovered Package: kreait/laravel-firebase
Discovered Package: larapack/doctrine-support
Discovered Package: larapack/voyager-hooks
Discovered Package: laravel/sail
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: lexxyungcarter/chatmessenger
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: tcg/voyager
Package manifest generated successfully.
对此问题的任何帮助表示赞赏。