1、执行命令:composer install 时,报错:Script Google\Task\Composer::cleanup handling the pre-autoload-dump event terminated with an exception。如图1

/object # composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update `.
Package operations: 1 install, 0 updates, 0 removals
- Installing google/apiclient-services (v0.226.0): Extracting archive
Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Package moontoast/math is abandoned, you should avoid using it. Use brick/math instead.
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating optimized autoload files
> Google\Task\Composer::cleanup
Removing 209 google services
Script Google\Task\Composer::cleanup handling the pre-autoload-dump event terminated with an exception
[Symfony\Component\Filesystem\Exception\IOException]
Failed to remove directory "/object/vendor/google/apiclient-services/src/Assuredworkloads": rmdir(/object/vendor/google/apiclient-services/src/Assuredworkloads): Directory not empty.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-scripts] [--no-progress] [--no-install] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] []...
2、查看 /vendor/google/apiclient/README.md,清理未使用的服务,有超过 200 个 Google API 服务。 很有可能你不会都想要。 为了避免在您的代码中传送这些依赖项,你可以运行 `Google\Task\Composer::cleanup` 任务并指定服务你想保留在 `composer.json` 中:
{
"require": {
"google/apiclient": "^2.12.1"
},
"scripts": {
"pre-autoload-dump": "Google\\Task\\Composer::cleanup"
},
"extra": {
"google/apiclient-services": [
"Drive",
"YouTube"
]
}
}
3、编辑 composer.json,决定在 scripts 中,先删除掉:”pre-autoload-dump”: “Google\\Task\\Composer::cleanup” 。如图2

"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
],
"lint": "phpcs --standard=PSR1,PSR2,./ruleset.xml --ignore=config/us-zipcode.php app/ routes/ config/ ",
"lint-fix": "phpcbf --standard=PSR1,PSR2 --ignore=config/us-zipcode.php app/ routes/ config/ "
}
4、执行 composer update 时,不再报错。但是,这是在容器中执行,后来在本地 Windows 主机上执行不存在此问题。如图3

需要长期技术维护或远程问题排查?
我是拥有 15+ 年经验的 PHP / Go 后端工程师,长期关注已有系统维护、Bug 修复、性能优化、服务器排查、WordPress 网站维护和小功能迭代。
如果你的项目遇到以下情况,可以先从一次小问题排查开始合作:
- ✅ PHP / Laravel / Yii2 老项目无人维护
- ✅ Go / Gin 后端接口需要排查或优化
- ✅ WordPress 网站访问慢、报错或插件冲突
- ✅ Nginx / MySQL / Redis / Linux 服务器异常
- ✅ CDN / Cloudflare / DNS / HTTPS 配置问题
- ✅ 需要长期远程技术支持或兼职维护
更多介绍请查看:关于我 & 合作
微信:13980074657
邮箱:shuijingwanwq@gmail.com
Telegram:@shuijingwan
GitHub:https://github.com/shuijingwan

发表回复