linux - Composer 更新不运行

标签 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: 

连接被拒绝

如果我从我的浏览器访问 URL,它会通过,当我尝试从我的终端wgetcurl URL 时,它显示错误:

--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 时的完整跟踪:

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

我们将不胜感激!我似乎无法克服这个错误

最佳答案

Am on Ubuntu Linux 16.04, and below is what i had to do to fix the issue, as i mentiond earlier its some problem with proxy settings.

第一步

  • 转到系统设置
  • 网络
  • 网络代理
  • 改成无
  • 最后点击在系统范围内应用

第 2 步

  • 打开终端并输入以下命令。
    取消设置 https_proxy && 取消设置 socks_proxy && 取消设置 ftp_proxy

最后重启你的系统。上面的解决方案帮我解决了问题。

关于linux - Composer 更新不运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42056553/

相关文章:

authentication - 为 webpack 代理配置身份验证

python - 为什么 Pygame 不显示我的 pdf?

linux - 为 ARM 交叉编译 Node.js contextify

php - 提交后选择要打开的选项卡。

php - 使用表单更新 Laravel 数据库

go - 在谷歌云运行上设置转发代理

linux - 如何在 bash 末尾使用没有参数的 getopts 选项

linux - 自动清空内存缓存

php - laravel 8 - auth()->factory() {相同的刷新()和尝试()}在JWT Auth Controller 中未定义

用于TCP连接的Delphi透明代理