Composer更新无法运行

时间:2017-02-05 19:54:26

标签: linux laravel proxy composer-php

当我运行composer update时,它无法显示错误:

[Composer\Downloader\TransportException]                                                                           
The "https://packagist.org/packages.json" file could not be     downloaded: failed to open stream: 

拒绝连接

如果我从我的浏览器访问该网址,那么当我尝试 wget curl 来自我的终端的网址时,它会显示错误:

--2017-02-05 20:41:58--  https://packagist.org/packages.json
Connecting to 127.0.0.1:8888... failed: 
Connection refused.

--2017-02-05 20:41:58--  https://packagist.org/packages.json
Connecting to 127.0.0.1:8888... failed: Connection refused.

我认为它与代理连接有关,但后来我似乎无法解决问题。

如果我运行 composer update -vv ,Bellow就是完整的跟踪:

Reading ./composer.json
Loading config file ./composer.json
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/gidiscrap): git branch --no-color --no-                     abbrev -v
Cannot create cache directory      /home/oluwaslim/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/oluwaslim/.composer/cache/files/, or directory is not writable. Proceeding without cache
Failed to initialize global composer: Composer could not find the config file: /home/oluwaslim/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /var/www/gidiscrap/vendor/composer/installed.json
Running 1.3.2 (2017-01-27 18:23:41) with PHP 7.0.13-0ubuntu0.16.04.1 on Linux / 4.4.0-59-generic
Loading composer repositories with package information
   Downloading https://packagist.org/packages.json using proxy 127.0.0.1:8888
   Downloading https://packagist.org/packages.json using proxy 127.0.0.1:8888
   Downloading https://packagist.org/packages.json using proxy 127.0.0.1:8888


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


Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:489
 Composer\Util\RemoteFilesystem->get() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:101
 Composer\Util\RemoteFilesystem->getContents() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:665
 Composer\Repository\ComposerRepository->fetchFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:479
 Composer\Repository\ComposerRepository->loadRootServerFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:258
 Composer\Repository\ComposerRepository->hasProviders() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:99
 Composer\DependencyResolver\Pool->addRepository() at phar:///usr/local/bin/composer/src/Composer/Installer.php:376
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:223
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:158
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:257
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:850
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:193
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:227
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:124
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:100
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:54
 require() at /usr/local/bin/composer:24

帮助会受到欢迎!我似乎无法克服这个错误

2 个答案:

答案 0 :(得分:1)

  

我在Ubuntu Linux 16.04上,以下是我必须要解决的问题,正如我前面提到的代理设置的一些问题。

第1步

  • 转到系统设置
  • 网络
  • 网络代理
  • 将其更改为无
  • 最后点击Apply wide wide

第2步

  • 打开终端并输入以下命令 unset https_proxy && unset socks_proxy && unset ftp_proxy

最后重新启动系统。上面的解决方案让我解决了这个问题。

答案 1 :(得分:0)

numbers[1] = 2; numbers[4] = 2; numbers[3] = 2; numbers[5] = 2; numbers[7] = 2; <- this line overflows your array! numbers[9] = 2; <- and so would this. 表明您的系统存在问题。我猜这是一个非常积极的防病毒软件。除非您必须通过代理连接,否则您没有理由在端口8888上连接到localhost。你能做什么?检查防病毒设置并关闭通过HTTPS进行安全连接的检查。