Composer 2.0.8 问题 package-versions-deprecated

Composer 2.0.8 issue package-versions-deprecated

使用 php 7.2

- Installing composer/package-versions-deprecated (1.8.0): Extracting archive                                                                                                                                                               
Plugin initialization failed (include(/home/vagrant/.../vendor/composer/package-versions-deprecated/src/PackageVersions/Installer.php): failed to open stream: No such file or directory), uninstalling plugin                          
  - Removing composer/package-versions-deprecated (1.8.0)                                                                                                                                                                                     
    Install of composer/package-versions-deprecated failed                                                                                                                                                                                    
                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                              
  [RuntimeException]                                                                                                                                                                                                                          
  Could not delete /home/vagrant/.../vendor/composer/package-versions-deprecated/src:

我正在使用 laravel homestead 并且看到了这个但无法弄清楚问题是什么。为了从头开始,我多次删除并添加了 laravel homestead 框。但是,每次我在全新安装后遇到此问题。它也没有在 composer.json.

中列出
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.2",
        "ext-json": "*",
        "arcanedev/log-viewer": "^5.1",
        "asvae/laravel-api-tester": "^2.0",
        "aws/aws-sdk-php": "^3.101",
        "bepsvpt/secure-headers": "^5.3",
        "beyondcode/laravel-websockets": "^1.8",
        "doctrine/annotations": "^1.6",
        "doctrine/couchdb": "^1.0@beta",
        "doctrine/dbal": "^2.7",
        "fideloper/proxy": "^4.0",
        "firebase/php-jwt": "^5.0",
        "gluedev/laravel-stackdriver": "^0.1.2",
        "google/cloud": "^0.96.0",
        "google/protobuf": "^3.8",
        "graylog2/gelf-php": "^1.6",
        "hoa/console": "^3.17",
        "ircmaxell/random-lib": "^1.2",
        "kitetail/zttp": "^0.6.0",
        "ktamas77/firebase-php": "^2.2",
        "langleyfoxall/laravel-nist-password-rules": "^4.1",
        "laravel/framework": "6.18.22",
        "laravel/passport": "^9.3",
        "laravel/tinker": "^2.0",
        "laravel-notification-channels/twilio": "^3.1",
        "league/csv": "^9.1",
        "league/flysystem-aws-s3-v3": "^1.0",
        "league/flysystem-azure-blob-storage": "^0.1.6",
        "league/flysystem-cached-adapter": "^1.0",
        "league/flysystem-rackspace": "^1.0",
        "league/flysystem-sftp": "^1.0",
        "league/flysystem-webdav": "^1.0",
        "league/flysystem-ziparchive": "^1.0",
        "mockery/mockery": "^1.0",
        "mollie/polyfill-libsodium": "^1.1",
        "nexmo/client": "^1.8",
        "nyholm/psr7": "^1.1",
        "ocramius/package-versions": "1.4.2",
        "opencensus/opencensus-exporter-stackdriver": "~0.1",
        "pda/pheanstalk": "^4.0",
        "php-amqplib/php-amqplib": "^2.9",
        "php-console/php-console": "^3.1",
        "phpseclib/mcrypt_compat": "^1.0",
        "phpunit/php-invoker": "^2.0",
        "predis/predis": "^1.1",
        "propaganistas/laravel-intl": "^3.0",
        "propaganistas/laravel-phone": "^4.2",
        "psr/event-dispatcher": "^1.0",
        "pusher/pusher-php-server": "~3.4.1",
        "ramsey/uuid-doctrine": "^1.5",
        "rbdwllr/reallysimplejwt": "^2.0.42",
        "rollbar/rollbar": "^1.8",
        "ruflin/elastica": "^6.1",
        "spatie/flysystem-dropbox": "^1.1",
        "spatie/laravel-fractal": "^5.6",
        "spatie/laravel-permission": "^3.6",
        "symfony/browser-kit": "^4.3",
        "symfony/config": "^4.3",
        "symfony/dependency-injection": "^4.3",
        "symfony/dom-crawler": "^4.3",
        "symfony/expression-language": "^4.3",
        "symfony/lock": "^4.3",
        "symfony/translation": "4.3.8",
        "symfony/yaml": "^4.3",
        "titasgailius/search-relations": "^1.0",
        "true/punycode": "^2.1",
        "twilio/sdk": "^6.10",
        "unicodeveloper/laravel-password": "1.0.*",
        "voiceit-php/voiceit2": "^3.0",
        "whoops/soap": "^1.0",
        "wildbit/swiftmailer-postmark": "^3.0"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.3",
        "beyondcode/laravel-er-diagram-generator": "^0.2.2",
        "coderello/laravel-populated-factory": "^0.3.0",
        "facade/ignition": "^1.16",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^3.0",
        "phpunit/phpunit": "^8.0",
        "squizlabs/php_codesniffer": "^3.3"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

我的 windows 机器上的全局 composer.json...

{
    "require": {
        "squizlabs/php_codesniffer": "^3.4",
        "laravel/installer": "^3.0",
        "cretueusebiu/valet-windows": "^2.1"
    }
}

我只有 运行 composer install 并在全新安装时获取它。我的代码库最初是基于 composer v1 构建的,我正在尝试将命名空间迁移到 psr-4 更新和 运行 到这个问题中。

如果我 运行 composer install --no-plugins,我可以 运行。但是,我无法找到可以安装插件的位置。我 运行 在我的 laravel 应用程序根目录中。

输出


➜  ... git:(develop) ✗ rm -rf vendor
➜  ... git:(develop) ✗ composer clear-cache
Cache directory does not exist (cache-vcs-dir):
Clearing cache (cache-repo-dir): /home/vagrant/.cache/composer/repo
Clearing cache (cache-files-dir): /home/vagrant/.cache/composer/files
Clearing cache (cache-dir): /home/vagrant/.cache/composer
All caches cleared.
➜  ... git:(develop) ✗ rm composer.lock
➜  ... git:(develop) ✗ composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 259 installs, 0 updates, 0 removals
  - Locking arcanedev/log-viewer (5.2.0)
  - Locking arcanedev/support (5.2.0)
  - Locking asvae/laravel-api-tester (2.0.11)
  - Locking aws/aws-sdk-php (3.166.2)
  - Locking barryvdh/laravel-debugbar (v3.5.1)
  - Locking bepsvpt/secure-headers (5.6.0)
  - Locking beyondcode/laravel-er-diagram-generator (0.2.3)
  - Locking beyondcode/laravel-websockets (1.9.0)
  - Locking cache/adapter-common (1.1.0)
  - Locking cache/tag-interop (1.0.1)
  - Locking cboden/ratchet (v0.4.3)
  - Locking coderello/laravel-populated-factory (0.3.2)
  - Locking commerceguys/intl (v1.0.7)
  - Locking composer/package-versions-deprecated (1.8.0)
  - Locking defuse/php-encryption (v2.2.1)
  - Locking divineomega/do-file-cache (v2.0.6)
  - Locking divineomega/do-file-cache-psr-6 (v2.0.1)
  - Locking divineomega/laravel-password-exposed-validation-rule (v2.3.0)
  - Locking divineomega/password_exposed (v3.1.1)
  - Locking divineomega/psr-18-guzzle-adapter (v1.1.0)
  - Locking dnoegel/php-xdg-base-dir (v0.1.1)
  - Locking doctrine/annotations (1.11.1)
  - Locking doctrine/cache (1.10.2)
  - Locking doctrine/collections (1.6.7)
  - Locking doctrine/common (3.1.0)
  - Locking doctrine/couchdb (1.0.0-beta4)
  - Locking doctrine/dbal (2.12.1)
  - Locking doctrine/event-manager (1.1.1)
  - Locking doctrine/inflector (2.0.3)
  - Locking doctrine/instantiator (1.4.0)
  - Locking doctrine/lexer (1.2.1)
  - Locking doctrine/orm (2.8.1)
  - Locking doctrine/persistence (2.1.0)
  - Locking dragonmantank/cron-expression (v2.3.1)
  - Locking egulias/email-validator (2.1.24)
  - Locking elasticsearch/elasticsearch (v6.7.2)
  - Locking evenement/evenement (v3.0.1)
  - Locking facade/flare-client-php (1.3.7)
  - Locking facade/ignition (1.16.4)
  - Locking facade/ignition-contracts (1.0.2)
  - Locking fideloper/proxy (4.4.1)
  - Locking filp/whoops (2.9.1)
  - Locking firebase/php-jwt (v5.2.0)
  - Locking fzaninotto/faker (v1.9.1)
  - Locking giggsey/libphonenumber-for-php (8.12.14)
  - Locking giggsey/locale (1.9)
  - Locking gluedev/laravel-stackdriver (0.1.2)
  - Locking google/auth (v1.14.3)
  - Locking google/cloud (v0.96.0)
  - Locking google/common-protos (0.1.0)
  - Locking google/gax (0.38.2)
  - Locking google/grpc-gcp (0.1.5)
  - Locking google/protobuf (v3.14.0)
  - Locking graham-campbell/guzzle-factory (v3.0.4)
  - Locking graylog2/gelf-php (1.6.5)
  - Locking grpc/grpc (1.34.0)
  - Locking guzzle/guzzle (v3.8.1)
  - Locking guzzlehttp/guzzle (6.5.5)
  - Locking guzzlehttp/promises (1.4.0)
  - Locking guzzlehttp/psr7 (1.7.0)
  - Locking guzzlehttp/ringphp (1.1.1)
  - Locking guzzlehttp/streams (3.0.0)
  - Locking hamcrest/hamcrest-php (v2.0.1)
  - Locking hoa/consistency (1.17.05.02)
  - Locking hoa/console (3.17.05.02)
  - Locking hoa/event (1.17.01.13)
  - Locking hoa/exception (1.17.01.16)
  - Locking hoa/file (1.17.07.11)
  - Locking hoa/iterator (2.17.01.10)
  - Locking hoa/protocol (1.17.01.14)
  - Locking hoa/stream (1.17.02.21)
  - Locking hoa/ustring (4.17.01.16)
  - Locking ircmaxell/random-lib (v1.2.0)
  - Locking ircmaxell/security-lib (v1.1.0)
  - Locking jakub-onderka/php-console-color (v0.2)
  - Locking jakub-onderka/php-console-highlighter (v0.4)
  - Locking kitetail/zttp (v0.6.0)
  - Locking ktamas77/firebase-php (2.2.2)
  - Locking laminas/laminas-diactoros (2.5.0)
  - Locking laminas/laminas-zendframework-bridge (1.1.1)
  - Locking langleyfoxall/laravel-nist-password-rules (v4.3.0)
  - Locking laravel-notification-channels/twilio (3.1.2)
  - Locking laravel/framework (v6.18.22)
  - Locking laravel/passport (v9.3.1)
  - Locking laravel/tinker (v2.5.0)
  - Locking lcobucci/jwt (3.4.1)
  - Locking league/commonmark (1.5.7)
  - Locking league/csv (9.6.1)
  - Locking league/event (2.2.0)
  - Locking league/flysystem (1.1.3)
  - Locking league/flysystem-aws-s3-v3 (1.0.29)
  - Locking league/flysystem-azure-blob-storage (0.1.6)
  - Locking league/flysystem-cached-adapter (1.1.0)
  - Locking league/flysystem-rackspace (1.0.5)
  - Locking league/flysystem-sftp (1.0.22)
  - Locking league/flysystem-webdav (1.0.9)
  - Locking league/flysystem-ziparchive (1.0.3)
  - Locking league/fractal (0.19.2)
  - Locking league/iso3166 (3.0.0)
  - Locking league/mime-type-detection (1.5.1)
  - Locking league/oauth2-server (8.2.3)
  - Locking maximebf/debugbar (v1.16.4)
  - Locking microsoft/azure-storage-blob (1.5.1)
  - Locking microsoft/azure-storage-common (1.5.0)
  - Locking mikemccabe/json-patch-php (0.1.0)
  - Locking mockery/mockery (1.4.2)
  - Locking mollie/polyfill-libsodium (v1.1.1)
  - Locking monolog/monolog (1.25.5)
  - Locking mtdowling/jmespath.php (2.6.0)
  - Locking myclabs/deep-copy (1.10.2)
  - Locking nesbot/carbon (2.42.0)
  - Locking nexmo/client (1.9.1)
  - Locking nexmo/client-core (1.8.1)
  - Locking nikic/php-parser (v4.10.3)
  - Locking nunomaduro/collision (v3.1.0)
  - Locking nyholm/psr7 (1.3.2)
  - Locking opencensus/opencensus (v0.5.2)
  - Locking opencensus/opencensus-exporter-stackdriver (v0.1.0)
  - Locking opis/closure (3.6.1)
  - Locking paragonie/certainty (v2.8.0)
  - Locking paragonie/constant_time_encoding (v2.4.0)
  - Locking paragonie/random_compat (v9.99.99)
  - Locking paragonie/sodium_compat (v1.14.0)
  - Locking pda/pheanstalk (v4.0.3)
  - Locking phar-io/manifest (2.0.1)
  - Locking phar-io/version (3.0.3)
  - Locking php-amqplib/php-amqplib (v2.12.1)
  - Locking php-console/php-console (3.1.8)
  - Locking php-http/discovery (1.13.0)
  - Locking php-http/guzzle6-adapter (v1.1.1)
  - Locking php-http/httplug (v1.1.0)
  - Locking php-http/message-factory (v1.0.2)
  - Locking php-http/promise (1.1.0)
  - Locking phpdocumentor/graphviz (1.0.4)
  - Locking phpdocumentor/reflection-common (2.2.0)
  - Locking phpdocumentor/reflection-docblock (5.2.2)
  - Locking phpdocumentor/type-resolver (1.4.0)
  - Locking phpoption/phpoption (1.7.5)
  - Locking phpseclib/mcrypt_compat (1.0.11)
  - Locking phpseclib/phpseclib (2.0.29)
  - Locking phpspec/prophecy (1.12.1)
  - Locking phpunit/php-code-coverage (7.0.14)
  - Locking phpunit/php-file-iterator (2.0.3)
  - Locking phpunit/php-invoker (2.0.1)
  - Locking phpunit/php-text-template (1.2.1)
  - Locking phpunit/php-timer (2.1.3)
  - Locking phpunit/php-token-stream (4.0.4)
  - Locking phpunit/phpunit (8.5.13)
  - Locking predis/predis (v1.1.6)
  - Locking propaganistas/laravel-intl (3.1.0)
  - Locking propaganistas/laravel-phone (4.2.7)
  - Locking psr/cache (1.0.1)
  - Locking psr/container (1.0.0)
  - Locking psr/event-dispatcher (1.0.0)
  - Locking psr/http-client (1.0.1)
  - Locking psr/http-factory (1.0.1)
  - Locking psr/http-message (1.0.1)
  - Locking psr/log (1.1.3)
  - Locking psr/simple-cache (1.0.1)
  - Locking psy/psysh (v0.10.5)
  - Locking punic/punic (3.5.1)
  - Locking pusher/pusher-php-server (v4.1.4)
  - Locking rackspace/php-opencloud (v1.16.0)
  - Locking ralouphie/getallheaders (3.0.3)
  - Locking ramsey/uuid (3.9.3)
  - Locking ramsey/uuid-doctrine (1.6.0)
  - Locking ratchet/rfc6455 (v0.3)
  - Locking rbdwllr/reallysimplejwt (2.1.0)
  - Locking react/cache (v1.1.0)
  - Locking react/dns (v1.4.0)
  - Locking react/event-loop (v1.1.1)
  - Locking react/http (v1.2.0)
  - Locking react/promise (v2.8.0)
  - Locking react/promise-stream (v1.2.0)
  - Locking react/promise-timer (v1.6.0)
  - Locking react/socket (v1.6.0)
  - Locking react/stream (v1.1.1)
  - Locking ringcentral/psr7 (1.3.0)
  - Locking rize/uri-template (0.3.2)
  - Locking rollbar/rollbar (v1.8.1)
  - Locking ruflin/elastica (6.1.1)
  - Locking sabre/dav (4.1.3)
  - Locking sabre/event (5.1.2)
  - Locking sabre/http (5.1.1)
  - Locking sabre/uri (2.2.1)
  - Locking sabre/vobject (4.3.3)
  - Locking sabre/xml (2.2.3)
  - Locking scrivo/highlight.php (v9.18.1.5)
  - Locking sebastian/code-unit-reverse-lookup (1.0.2)
  - Locking sebastian/comparator (3.0.3)
  - Locking sebastian/diff (3.0.3)
  - Locking sebastian/environment (4.2.4)
  - Locking sebastian/exporter (3.1.3)
  - Locking sebastian/global-state (3.0.1)
  - Locking sebastian/object-enumerator (3.0.4)
  - Locking sebastian/object-reflector (1.1.2)
  - Locking sebastian/recursion-context (3.0.1)
  - Locking sebastian/resource-operations (2.0.2)
  - Locking sebastian/type (1.1.4)
  - Locking sebastian/version (2.0.1)
  - Locking spatie/dropbox-api (1.16.1)
  - Locking spatie/flysystem-dropbox (1.2.3)
  - Locking spatie/fractalistic (2.9.1)
  - Locking spatie/laravel-fractal (5.8.0)
  - Locking spatie/laravel-permission (3.18.0)
  - Locking squizlabs/php_codesniffer (3.5.8)
  - Locking swiftmailer/swiftmailer (v6.2.3)
  - Locking symfony/browser-kit (v4.4.17)
  - Locking symfony/cache (v5.2.0)
  - Locking symfony/cache-contracts (v2.2.0)
  - Locking symfony/config (v4.4.17)
  - Locking symfony/console (v4.4.17)
  - Locking symfony/css-selector (v5.2.0)
  - Locking symfony/debug (v4.4.17)
  - Locking symfony/dependency-injection (v4.4.17)
  - Locking symfony/deprecation-contracts (v2.2.0)
  - Locking symfony/dom-crawler (v4.4.17)
  - Locking symfony/error-handler (v4.4.17)
  - Locking symfony/event-dispatcher (v4.4.17)
  - Locking symfony/event-dispatcher-contracts (v1.1.9)
  - Locking symfony/expression-language (v4.4.17)
  - Locking symfony/filesystem (v5.2.0)
  - Locking symfony/finder (v4.4.17)
  - Locking symfony/http-client-contracts (v2.3.1)
  - Locking symfony/http-foundation (v4.4.17)
  - Locking symfony/http-kernel (v4.4.17)
  - Locking symfony/lock (v4.4.17)
  - Locking symfony/mime (v5.2.0)
  - Locking symfony/polyfill-ctype (v1.20.0)
  - Locking symfony/polyfill-iconv (v1.20.0)
  - Locking symfony/polyfill-intl-idn (v1.20.0)
  - Locking symfony/polyfill-intl-normalizer (v1.20.0)
  - Locking symfony/polyfill-mbstring (v1.20.0)
  - Locking symfony/polyfill-php72 (v1.20.0)
  - Locking symfony/polyfill-php73 (v1.20.0)
  - Locking symfony/polyfill-php80 (v1.20.0)
  - Locking symfony/process (v4.4.17)
  - Locking symfony/psr-http-message-bridge (v2.0.2)
  - Locking symfony/routing (v4.4.17)
  - Locking symfony/service-contracts (v2.2.0)
  - Locking symfony/translation (v4.3.8)
  - Locking symfony/translation-contracts (v1.1.10)
  - Locking symfony/var-dumper (v4.4.17)
  - Locking symfony/var-exporter (v5.2.0)
  - Locking symfony/yaml (v4.4.17)
  - Locking theseer/tokenizer (1.2.0)
  - Locking tightenco/collect (v5.8.38)
  - Locking tijsverkoyen/css-to-inline-styles (2.2.3)
  - Locking titasgailius/search-relations (1.0.6)
  - Locking true/punycode (v2.1.1)
  - Locking twilio/sdk (6.14.0)
  - Locking umpirsky/country-list (2.0.6)
  - Locking umpirsky/locale-list (1.0.0)
  - Locking unicodeveloper/laravel-password (1.0.3)
  - Locking vlucas/phpdotenv (v3.6.7)
  - Locking voiceit-php/voiceit2 (3.6.0)
  - Locking webmozart/assert (1.9.1)
  - Locking whoops/soap (1.0.0)
  - Locking wildbit/swiftmailer-postmark (3.3.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 259 installs, 0 updates, 0 removals
  - Downloading composer/package-versions-deprecated (1.8.0)
  - Downloading psr/log (1.1.3)
  - Downloading symfony/polyfill-ctype (v1.20.0)
  - Downloading phpoption/phpoption (1.7.5)
  - Downloading vlucas/phpdotenv (v3.6.7)
  ....
  - Downloading symfony/var-exporter (v5.2.0)
  - Downloading symfony/cache (v5.2.0)
  - Downloading symfony/expression-language (v4.4.17)
  - Downloading symfony/lock (v4.4.17)
  - Downloading symfony/yaml (v4.4.17)
  - Downloading titasgailius/search-relations (1.0.6)
  - Downloading true/punycode (v2.1.1)
  - Downloading unicodeveloper/laravel-password (1.0.3)
  - Downloading voiceit-php/voiceit2 (3.6.0)
  - Downloading whoops/soap (1.0.0)
  - Downloading wildbit/swiftmailer-postmark (3.3.0)
  - Installing composer/package-versions-deprecated (1.8.0): Extracting archive
Plugin initialization failed (include(/home/vagrant/.../vendor/composer/package-versions-deprecated/src/PackageVersions/Installer.php): failed to open stream: No such file or directory), uninstalling plugin
  - Removing composer/package-versions-deprecated (1.8.0)
    Install of composer/package-versions-deprecated failed


  [RuntimeException]
  Could not delete /home/vagrant/.../vendor/composer/package-versions-deprecated/src:

这似乎是虚拟框文件系统的问题。我为作曲家创建了一个问题,希望能获得更多见解。

https://github.com/composer/package-versions-deprecated/issues/21

讨论 here and here 指出这是 virtualbox 的一个问题,特别是 vboxfs 以及一些关于新创建的文件(即正在解压缩的 zip)没有从主机完全准备好 OS.

存在一种变通方法,在 zip 之后延迟似乎有效。归功于 rpkamp.

以下对我有用(Laravel Homestead 项目,php7.4,virtualbox 和 vagrant):

1 - 在某处创建一个名为 unzip 的脚本。也可以在项目的根目录中(composer.json 所在的位置)。如果您的存储速度较慢(例如硬盘),请调整时间,例如 sleep 0.9.

#!/bin/sh
    
/usr/bin/unzip "$@"
sleep 0.2

2 - 输入 Vagrant 实例(此步骤之后的所有内容都在其中发生):

vagrant ssh

3 - 将脚本复制到 usr/local/bin:

sudo cp /path/to/unzip /usr/local/bin

4 - 允许文件可执行,使用:

sudo chmod +x /usr/local/bin/unzip

5 - 现在在您的站点根目录中再次尝试 运行 composer

composer install

理想情况下,此修复是临时的,将来会被删除。 还要记住您的部署环境;它也需要这个脚本吗?

更新到最新版本为我提供了解决方案:

composer self-update --snapshot

在使用 composer 发布问题后,真正的答案是文件系统没有与 VM 正确同步。在这种情况下,它是虚拟盒子,似乎这个问题可能已经存在了一段时间,但随着作曲家的 efficiency/optimization 变得更加尖锐,这个问题变得更加普遍。我相信他们已经进行了一些更新,并且在使用 composer v2 时问题似乎消退了。