Reputation: 431
Good day people, I have been having this problem for days now, when I try to download dependencies for my php project using composer I get this error
c:\wamp64\www\Test>composer global require "fxp/composer-asset-plugin:^1.3.1"
Changed current directory to C:/Users/Nwachukwu Favour/AppData/Roaming/Composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Installation failed, reverting ./composer.json to its original content.
[Composer\Downloader\TransportException]
The "http://packagist.org/p/provider-2014%241cf88bd0ed4076dc091407477ba2a76483e8598ee5365673381262e6c1d40fcf.jso
n" file could not be downloaded: failed to open stream: HTTP request failed!
require [--dev] [--prefer-source] [--prefer-dist] [--no-plugins] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]...
I am running a windows 10 OS and am suspecting that my system cannot download from the command line. I would be very glad if someone can help me solve this problem because it is hindering my project. Thanks in advance.
Upvotes: 22
Views: 69362
Reputation: 1
Windows OP users: Clear "http_proxy" variable in the "Edit the system environment variables" and check it again! Then use composer "selfupdate" or "diagnose" command to check it.
Upvotes: 0
Reputation: 121
If you have http_proxy
environment variable, just delete it from either User variables or System variable and save yourself from all this trouble.
Upvotes: 0
Reputation: 1
This problem happened to me, and I solved it by turning off the firewall. This is one of the solutions.
Upvotes: 0
Reputation: 905
just put this in command
composer config -g repo.packagist composer https://packagist.org
Upvotes: 3
Reputation: 1
if you are in china like me,try this:https://developer.aliyun.com/composer github connection not stable recently.I tryed https://pkg.phpcomposer.com/ first but don't work. I tryed composer diag and composer -vvv and wait.out put show cache file is :Writing C:/Users/Administrator.000/AppData/Local/Composer/repo.so i copy cache file from my colleague,and it works first,laravel run,but composer require show 404.then i found the solution above.try composer update -lock and change the repositories url to ali's.And solved.
Upvotes: 0
Reputation: 51
I tried the command below and it worked.
composer config -g repo.packagist composer https://packagist.org
This is just one of the options given above.
Upvotes: 5
Reputation:
Your are good to go.
Upvotes: 1
Reputation: 2491
I had the same error, but it was resolved in a different way for me. I used to give sudo to composer commands because folder /home/aspire/.composer
is in sudo permission. I changed it to sudo chown $USER /home/aspire/.composer
.
I changed the permissions as I mentioned and I ran the code
sudo composer require symfony/orm-pack
Throws error
[Composer\Downloader\TransportException]
The "https://repo.packagist.org/packages.json" file could not be downloaded:
Then I tried
composer require symfony/orm-pack
It works
If anyone know the exact reason, please comment
Upvotes: 0
Reputation: 2823
You could also run this command on the CLI before installing any dependencies. It forces composer to use https to download all resources:
composer config -g repo.packagist composer https://packagist.org
Upvotes: 45
Reputation: 1202
I just updated my composer to the latest version and this problem is solved.
Try
composer self-update
To know the current version and update details:
composer diagnose
Upvotes: 11
Reputation: 39
just stop your antivirus software :)
for some reason antivirus software kaspersky doesn't like composer :(
I had the same error tried everything... nothing worked.
I remembered I had issues with composer in the past while my AV was on... turned it off and composer worked like a charm :)
Upvotes: 2
Reputation: 736
The issue could be caused by the redirect from http to https. (or your firewall blocking the call)
According to this article the problem could be solved by adding the following to your composer.json:
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
Forcing composer to use https connections to Packagist
Upvotes: 16
Reputation: 166
I found enabling OpenSSL extension in the php.ini-development/production file fixed the problem. Its located within your PHP install
Upvotes: 3