本文介绍了Laravel-作曲家更新:连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在生产服务器上执行$ composer update时,出现以下消息:

When I do $ composer update on prod server, I get this message:

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

它过去一个月前工作正常.

It used to work fine a month ago.

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

Here is the list of my installed packages (if it helps):

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.

The only new package I added since last time is consoletvs/invoices.

我尝试了作曲家的自我更新,但是我没有任何代理之类的东西.

I tried composer self-update, and I don't have any proxy or such things.

这是我的配置:

  • Laravel 5.5
  • Composer 1.7.2
  • PHP 7.2 PHP 7.1
  • 上进行了测试
  • 共享主机(OVH)
  • 已禁用IPv6
  • 防火墙已禁用
  • Laravel 5.5
  • Composer 1.7.2
  • Tested on PHP 7.2 and PHP 7.1
  • Shared hosting (OVH)
  • IPv6 disabled
  • Firewall disabled
$ ~/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(详细)添加堆栈跟踪调试

$ ~/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


EDIT

I've just tried $ curl https://larapack.io/packages.json

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

但是,如果我执行curl https://packagist.org/packages.json,它会起作用.

But if I do curl https://packagist.org/packages.json, it works.

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

Note that both files are accessible through my browser.

这使我怀疑IPv6实际上是否被禁用...

It gives me doubts about IPv6 being actually disabled...

我已经尝试了好几种方法,但是找不到合适的方法来检查它是否已禁用.

推荐答案

我通过composer install而不是composer update解决了它.

I solved it doing composer install instead of composer update.

仍然不知道为什么它不起作用,但至少现在可以起作用...

Still no idea about why it didn't work, but at least it works now...

对于试图(按照我的习惯)在生产环境中进行composer update的人们,不要:

For people trying (as I used to) to do composer update in a context of production, don't:

作曲家更新之间有何区别并安装作曲家?

composer install主要用于"部署阶段"中,使用存储在composer.lock文件中的相同依赖项在生产服务器或测试环境上安装我们的应用程序由composer update创建.

composer install is primarily used in the 'deploying phase' to install our application on a production server or on a testing environment, using the same dependencies stored in the composer.lock file created by composer update.

这里的图表很好

有关卷曲错误的讨论已发布在这里,以供参考:在浏览器中可以访问URL时,SSH Curl不起作用

A discussion about curl error was posted here for reference:SSH Curl doesn't work when URL is accessible in browser

对于在OVH使用SSH和共享托管专业版的法国开发人员,支持人员说在ssh中禁用了curl之类的外部调用,但是显然我可以做到curl https://packagist.org/packages.json.当他们尝试自己时,遇到诸如action forbidden之类的错误.这没有任何意义.

For french developers using SSH with a shared hosting pro at OVH, the support says external calls like curl are disabled in ssh, but obviously I could do curl https://packagist.org/packages.json. When they tried themselves, they got an error like action forbidden or something like that. It doesn't make any sense.

这篇关于Laravel-作曲家更新:连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 06:17