代码之家  ›  专栏  ›  技术社区  ›  charlie

Laravel-编写器更新:连接被拒绝

  •  1
  • charlie  · 技术社区  · 6 年前

    当我这么做的时候 $ composer update 在prod server上,我收到以下消息:

    [Composer\Downloader\TransportException]
    The "https://larapack.io/packages.json" file could not be downloaded: 
    failed to open stream: Connection refused
    

    一个月前还不错。

    下面是我安装的软件包列表(如果有帮助的话):

    arrilot/laravel-widgets               3.9.0   A powerful alternative to view composers. Asynchronous widgets, reloadable widgets, console...
    balping/json-raw-encoder              v1.0.0  Encode arrays to json with raw JS objects (eg. callbacks) in them
    composer/ca-bundle                    1.1.0   Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bun...composer/composer                     1.6.2   Composer helps you declare, manage and install dependencies of PHP projects, ensuring you h...
    composer/semver                       1.4.2   Semver library that offers utilities, version constraint parsing and validation.composer/spdx-licenses                1.2.0   SPDX licenses list and validation library.
    consoletvs/charts                     6.2.1   The laravel charting packagednoegel/php-xdg-base-dir              0.1     implementation of xdg base directory specification for php
    doctrine/annotations                  v1.6.0  Docblock Annotations Parserdoctrine/cache                        v1.7.1  Caching library offering an object-oriented API for many cache backends
    doctrine/collections                  v1.5.0  Collections Abstraction librarydoctrine/common                       v2.8.1  Common Library for Doctrine projects
    doctrine/dbal                         v2.6.3  Database Abstraction Layerdoctrine/inflector                    v1.3.0  Common String Manipulations with regard to casing and singular/plural rules.
    doctrine/instantiator                 1.1.0   A small, lightweight utility to instantiate objects in PHP without invoking their constructorsdoctrine/lexer                        v1.0.1  Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
    egulias/email-validator               2.1.3   A library for validating emails against several RFCserusev/parsedown                      1.6.4   Parser for Markdown.
    fideloper/proxy                       3.3.4   Set trusted proxies for Laravelfilp/whoops                           2.1.14  php error handling for cool kids
    fzaninotto/faker                      v1.7.1  Faker is a PHP library that generates fake data for you.
    geoip2/geoip2                         v2.8.0  MaxMind GeoIP2 PHP API
    gloudemans/shoppingcart               2.5.0   Laravel Shoppingcart
    guzzlehttp/psr7                       1.4.2   PSR-7 message implementation that also provides common utility methods
    hamcrest/hamcrest-php                 v2.0.0  This is the PHP port of Hamcrest Matchers
    intervention/image                    2.4.1   Image handling and manipulation library with support for Laravel integration
    jakub-onderka/php-console-color       0.1
    jakub-onderka/php-console-highlighter v0.3.2
    justinrainbow/json-schema             5.2.6   A library to validate a json schema.
    larapack/doctrine-support             v0.1.4  Better Doctrine Support with Laravel (Support for `enum`)
    larapack/hooks                        v1.0.1  A Laravel Hook system
    larapack/voyager-hooks                v1.0.4  Hooks integrated in Voyager
    laravel/framework                     v5.5.28 The Laravel Framework.
    laravel/tinker                        v1.0.3  Powerful REPL for the Laravel framework.
    league/flysystem                      1.0.41  Filesystem abstraction: Many filesystems, one API.
    maxmind-db/reader                     v1.3.0  MaxMind DB Reader API
    maxmind/web-service-common            v0.5.0  Internal MaxMind Web Service API
    mockery/mockery                       1.0     Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHP...
    monolog/monolog                       1.23.0  Sends your logs to files, sockets, inboxes, databases and various web services
    mtdowling/cron-expression             v1.2.1  CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is...
    myclabs/deep-copy                     1.7.0   Create deep copies (clones) of your objects
    nesbot/carbon                         1.22.1  A simple API extension for DateTime.
    nikic/php-parser                      v3.1.3  A PHP parser written in PHP
    paragonie/random_compat               v2.0.11 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
    phar-io/manifest                      1.0.1   Component for reading phar.io manifest information from a PHP Archive (PHAR)
    phar-io/version                       1.0.1   Library for handling version information and constraints
    phpdocumentor/reflection-common       1.0.1   Common reflection classes used by phpdocumentor to reflect the code structure
    phpdocumentor/reflection-docblock     4.2.0   With this component, a library can provide support for annotations via DocBlocks or otherwi...
    phpdocumentor/type-resolver           0.4.0
    phpspec/prophecy                      1.7.3   Highly opinionated mocking framework for PHP 5.3+
    phpunit/php-code-coverage             5.3.0   Library that provides collection, processing, and rendering functionality for PHP code cove...
    phpunit/php-file-iterator             1.4.5   FilterIterator implementation that filters files based on a list of suffixes.
    phpunit/php-text-template             1.2.1   Simple template engine.
    phpunit/php-timer                     1.0.9   Utility class for timing
    phpunit/php-token-stream              2.0.2   Wrapper around PHP's tokenizer extension.
    phpunit/phpunit                       6.5.5   The PHP Unit Testing framework.
    phpunit/phpunit-mock-objects          5.0.6   Mock Object library for PHPUnit
    psr/container                         1.0.0   Common Container Interface (PHP FIG PSR-11)
    psr/http-message                      1.0.1   Common interface for HTTP messages
    psr/log                               1.0.2   Common interface for logging libraries
    psr/simple-cache                      1.0.0   Common interfaces for simple caching
    psy/psysh                             v0.8.17 An interactive shell for modern PHP.
    ramsey/uuid                           3.7.1   Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 un...
    sebastian/code-unit-reverse-lookup    1.0.1   Looks up which function or method a line of code belongs to
    sebastian/comparator                  2.1.1   Provides the functionality to compare PHP values for equality
    sebastian/diff                        2.0.1   Diff implementation
    sebastian/environment                 3.1.0   Provides functionality to handle HHVM/PHP environments
    sebastian/exporter                    3.1.0   Provides the functionality to export PHP variables for visualization
    sebastian/global-state                2.0.0   Snapshotting of global state
    sebastian/object-enumerator           3.0.3   Traverses array structures and object graphs to enumerate all referenced objects
    sebastian/object-reflector            1.1.1   Allows reflection of object attributes, including inherited and non-public ones
    sebastian/recursion-context           3.0.0   Provides functionality to recursively process PHP variables
    sebastian/resource-operations         1.0.0   Provides a list of PHP built-in functions that operate on resources
    sebastian/version                     2.0.1   Library that helps with managing the version number of Git-hosted PHP projects
    seld/cli-prompt                       1.0.3   Allows you to prompt for user input on the command line, and optionally hide the characters...
    seld/jsonlint                         1.7.0   JSON Linter
    seld/phar-utils                       1.0.1   PHAR file format utilities, for when PHP phars you up
    simshaun/recurr                       v3.0.5  PHP library for working with recurrence rules
    swiftmailer/swiftmailer               v6.0.2  Swiftmailer, free feature-rich PHP mailer
    symfony/console                       v3.4.3  Symfony Console Component
    symfony/css-selector                  v3.4.3  Symfony CssSelector Component
    symfony/debug                         v3.4.3  Symfony Debug Component
    symfony/event-dispatcher              v4.0.3  Symfony EventDispatcher Component
    

    我上次添加的唯一新包是 consoletvs/invoices .

    我尝试了作曲家自我更新,我没有任何代理或类似的东西。

    这是我的配置:

    • 作曲家1.7.2
    • 测试日期
    • 共享主机 (卵母细胞)
    • IPv6已禁用

    编辑:编写器诊断结果

    $ ~/composer.phar diagnose
    
    Checking composer.json: OK
    Checking platform settings: WARNING
    PHP was compiled with --enable-sigchild which can cause issues on some platforms.
    Recompile it without this flag if possible, see also:
      https://bugs.php.net/bug.php?id=22999
    
    Checking git settings: OK
    Checking http connectivity to packagist: OK
    Checking https connectivity to packagist: OK
    Checking github.com rate limit: OK
    WARNING
    Github has a rate limit on their API. You currently have 0 out of 60 requests left.
    See https://developer.github.com/v3/#rate-limiting and also
        https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens
    Checking disk free space: OK
    Checking pubkeys:
    Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
    Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
    OK
    Checking composer version: OK
    Composer version: 1.7.2
    PHP version: 7.2.5
    PHP binary path: /usr/local/php7.2/bin/php
    

    编辑:使用-vvv(verbose)添加堆栈跟踪调试

    $ ~/composer.phar update -vvv
    
    Reading ./composer.json
    Loading config file ./composer.json
    Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
    Executing command (/home/user/www/dev): git branch --no-color --no-abbrev -v
    Failed to initialize global composer: Composer could not find the config file: /homez.188/user/.composer/composer.json
    To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
    Reading /home/user/www/dev/vendor/composer/installed.json
    Loading plugin Symfony\Thanks\Thanks
    Running 1.7.2 (2018-08-16 16:57:12) with PHP 7.1.17 on Linux / 4.14.61-ovh-vps-grsec-zfs-classid
    Loading composer repositories with package information
    Downloading https://larapack.io/packages.json
    Downloading https://larapack.io/packages.json
    Downloading https://larapack.io/packages.json
    
    
      [Composer\Downloader\TransportException]
      The "https://larapack.io/packages.json" file could not be downloaded: failed to open stream: Conn
      ection refused
    
    
    Exception trace:
     () at phar:///home/user/composer.phar/src/Composer/Util/RemoteFilesystem.php:547
     Composer\Util\RemoteFilesystem->get() at phar:///home/user/composer.phar/src/Composer/Util/RemoteFilesystem.php:101
     Composer\Util\RemoteFilesystem->getContents() at phar:///home/user/composer.phar/src/Composer/Repository/ComposerRepository.php:682
     Composer\Repository\ComposerRepository->fetchFile() at phar:///home/user/composer.phar/src/Composer/Repository/ComposerRepository.php:497
     Composer\Repository\ComposerRepository->loadRootServerFile() at phar:///home/user/composer.phar/src/Composer/Repository/ComposerRepository.php:276
     Composer\Repository\ComposerRepository->hasProviders() at phar:///home/user/composer.phar/src/Composer/DependencyResolver/Pool.php:99
     Composer\DependencyResolver\Pool->addRepository() at phar:///home/user/composer.phar/src/Composer/Installer.php:378
     Composer\Installer->doInstall() at phar:///home/user/composer.phar/src/Composer/Installer.php:228
     Composer\Installer->run() at phar:///home/user/composer.phar/src/Composer/Command/UpdateCommand.php:162
     Composer\Command\UpdateCommand->execute() at phar:///home/user/composer.phar/vendor/symfony/console/Command/Command.php:241
     Symfony\Component\Console\Command\Command->run() at phar:///home/user/composer.phar/vendor/symfony/console/Application.php:843
     Symfony\Component\Console\Application->doRunCommand() at phar:///home/user/composer.phar/vendor/symfony/console/Application.php:193
     Symfony\Component\Console\Application->doRun() at phar:///home/user/composer.phar/src/Composer/Console/Application.php:254
     Composer\Console\Application->doRun() at phar:///home/user/composer.phar/vendor/symfony/console/Application.php:117
     Symfony\Component\Console\Application->run() at phar:///home/user/composer.phar/src/Composer/Console/Application.php:103
     Composer\Console\Application->run() at phar:///home/user/composer.phar/bin/composer:56
     require() at /home/user/composer.phar:24
    
    update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...
    

    编辑

    我刚试过 $ curl https://larapack.io/packages.json

    我得到: curl: (7) Failed to connect to larapack.io port 443: Connection refused

    curl https://packagist.org/packages.json ,它起作用了。

    请注意,这两个文件都可以通过我的浏览器访问。

    它让我怀疑IPv6是否真的被禁用了。。。

    我试过好几种方法,但找不到合适的方法来检查它是否失效。

    1 回复  |  直到 6 年前
        1
  •  1
  •   charlie    6 年前

    我解决了这个问题 composer install 而不是 composer update .


    对于那些试图(像我以前那样)去做的人 编写器更新 在生产环境中,不要:

    What are the differences between composer update and composer install?

    • 主要用于 ,以根据 composer.json 文件,

    • 主要用于 部署阶段 '在生产服务器或测试环境上安装我们的应用程序,使用存储在 composer.lock 编写器更新

    以及 a nice diagram here .


    关于卷曲误差的讨论发表在这里供参考: SSH Curl doesn't work when URL is accessible in browser

    对于在OVH使用SSH和共享宿主pro的法国开发人员来说,支持说 curl curl https://packagist.org/packages.json action forbidden 或者类似的。这没有任何意义。