Composer diagnose and install error - php

If I run "composer diagnose" it gaves me a FAIL message when checking github.com rate limit:
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: SSL: Connection reset by peer
Failed to enable crypto
failed to open stream: operation failed
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
I'm NOT behind a proxy or firewall and I CAN download everything from HTTP or HTTPS. I've tried to change my cacert.pem and everything more. But nothing can fix it.
When I try to install a package an error occurs too:
sudo composer require cocur/slugify
Using version ^2.0 for cocur/slugify
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing cocur/slugify (v2.0)
Downloading: 100%
Downloading: 100%
Downloading: 100%
Failed to download cocur/slugify from dist: The "https://api.github.com/repos/cocur/slugify/zipball/912bf41f940f9a4e38ff1284b1841eaa71911d7f" file could not be downloaded: SSL: Connection reset by peer
Failed to enable crypto
failed to open stream: operation failed
Now trying to download from source
- Installing cocur/slugify (v2.0)
Cloning 912bf41f940f9a4e38ff1284b1841eaa71911d7f
The authenticity of host 'github.com (192.30.252.130)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Installation failed, reverting ./composer.json to its original content.
[RuntimeException]
Failed to clone https://github.com/cocur/slugify.git via https, ssh protocols, aborting.
- https://github.com/cocur/slugify.git
Cloning into '/home/user/temp/vendor/cocur/slugify'...
fatal: unable to access 'https://github.com/cocur/slugify.git/': gnutls_handshake() failed: A TLS packet with unexpected length was received.
- git#github.com:cocur/slugify.git
Cloning into '/home/user/temp/vendor/cocur/slugify'...
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
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>]...

Related

\[InvalidArgumentException\] Could not find package vlucas/phpdotenv. Couldn't download package

I'm having a problem with vlucas/phpdotenv installation
 ~/ nslookup repo.packagist.org
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: repo.packagist.org
Address: 54.37.2.184
My composer.json:
{
"name": "developer/mvc",
"authors": [
{
"name": "Abubakr Abduvakhidov",
"email": "abubakr#edu.thedevs.co"
}
],
"autoload": {
"psr-4": {
"app\\": "."
}
},
"require": {}
}
Output of composer diagnose:
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
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: 2.0.8
PHP version: 7.4.12
PHP binary path: /usr/local/Cellar/php/7.4.12/bin/php
OpenSSL version: OpenSSL 1.1.1h 22 Sep 2020
cURL version: 7.73.0 libz 1.2.11 ssl OpenSSL/1.1.1h
zip: extension present, unzip present
When I run this command:
composer require vlucas/phpdotenv -vvv
I get the following output:
Loading config file /Users/abubakr/.composer/config.json
Loading config file /Users/abubakr/.composer/auth.json
Failed to initialize global composer: Composer could not find the config file: /Users/abubakr/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 2.0.8 (2020-12-03 17:20:38) with PHP 7.4.12 on Darwin / 20.1.0
Loading config file /Users/abubakr/.composer/config.json
Loading config file /Users/abubakr/.composer/auth.json
Failed to initialize global composer: Composer could not find the config file: /Users/abubakr/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading ./composer.json
Loading config file /Users/abubakr/.composer/config.json
Loading config file /Users/abubakr/.composer/auth.json
Loading config file ./composer.json
Checked CA file /usr/local/etc/openssl#1.1/cert.pem: valid
Executing command (/Users/abubakr): git branch -a --no-color --no-abbrev -v
Executing command (/Users/abubakr): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/Users/abubakr): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/Users/abubakr): hg branch
Executing command (/Users/abubakr): fossil branch list
Executing command (/Users/abubakr): fossil tag list
Executing command (/Users/abubakr): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /Users/abubakr/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Downloading https://packagist.phpcomposer.com/packages.json
[200] https://packagist.phpcomposer.com/packages.json
Writing /Users/abubakr/.composer/cache/repo/https---packagist.phpcomposer.com/packages.json into cache
Downloading https://packagist.phpcomposer.com/p2/vlucas/phpdotenv.json
[404] https://packagist.phpcomposer.com/p2/vlucas/phpdotenv.json
Downloading https://packagist.phpcomposer.com/p2/vlucas/phpdotenv~dev.json
[404] https://packagist.phpcomposer.com/p2/vlucas/phpdotenv~dev.json
Downloading https://packagist.org/search.json?q=vlucas/phpdotenv&type=
[200] https://packagist.org/search.json?q=vlucas/phpdotenv&type=
[RuntimeException]
No composer.json present in the current directory, this may be the cause of
the following exception.
Exception trace:
() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Command/RequireCommand.php:193
Composer\Command\RequireCommand->execute() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Command/Command.php:245
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:835
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:185
Symfony\Component\Console\Application->doRun() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Console/Application.php:310
Composer\Console\Application->doRun() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Console/Application.php:122
Composer\Console\Application->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/bin/composer:63
require() at /usr/local/Cellar/composer/2.0.6/bin/composer:24
[InvalidArgumentException]
Could not find package vlucas/phpdotenv.
Did you mean one of these?
vlucas/phpdotenv
sobyte/dotenv-php
calgamo/module-php-dotenv
abacaphiliac/zend-phpdotenv
davek1312/config
Exception trace:
() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Command/InitCommand.php:796
Composer\Command\InitCommand->findBestVersionAndNameForPackage() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Command/InitCommand.php:430
Composer\Command\InitCommand->determineRequirements() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Command/RequireCommand.php:189
Composer\Command\RequireCommand->execute() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Command/Command.php:245
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:835
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:185
Symfony\Component\Console\Application->doRun() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Console/Application.php:310
Composer\Console\Application->doRun() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/src/Composer/Console/Application.php:122
Composer\Console\Application->run() at phar:///usr/local/Cellar/composer/2.0.6/bin/composer/bin/composer:63
require() at /usr/local/Cellar/composer/2.0.6/bin/composer:24
require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>]...
And I expected this to happen:
package to be installed
Additional:
 /Applications/XAMPP/xamppfiles/htdocs/php/mvc/ [master+*] which composer
/usr/local/bin/composer
 /Applications/XAMPP/xamppfiles/htdocs/php/mvc/ [master+*] alias | grep composer
 /Applications/XAMPP/xamppfiles/htdocs/php/mvc/ [master+*] ls
composer.json core models vendor
composer.lock migrations public views
controllers migrations.php runtime
Actually, it was because of loading metadata from https://packagist.phpcomposer.com/packages.json, which is not the official Packagist, but an official mirror (and a broken one according to the list in https://github.com/Webysther/packagist-mirror#-packagist-public-metadata-mirrors-observatory-around-the-world)
That's probably the reason for the issue: the package is not found in the metadata in this repository, but the repository still exposes the official search endpoint instead of a mirrored one, which is used by composer when looking for alternative names.
After running the command in the bottom it started downloading
composer config -g repo.packagist composer https://packagist.org

Composer update error: Installing smatar/laravel-settings (1.3): Downloading (failed). Laravel

I'm having this error when I execute composer update in my laravel project (it's been working for years):
- Installing smatar/laravel-settings (1.3): Downloading (failed) Failed to download smatar/laravel-settings from dist: The "https://api.github.com/repos/SMATAR/laravel-settings/zipball/7b76462fe90224688c632d90c5f84a28c0f6e2bc" file could not be downloaded (HTTP/1.1 404 Not Found)
Now trying to download from source
- Installing smatar/laravel-settings (1.3): The authenticity of host 'github.com (18.231.5.6)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Cloning 7b76462fe9
[RuntimeException]
Failed to clone https://github.com/SMATAR/laravel-settings.git via https, ssh protocols, aborting.
- https://github.com/SMATAR/laravel-settings.git
Cloning into '/var/www/html/prod/web/vendor/smatar/laravel-settings'...
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/SMATAR/laravel-settings.git/'
- git#github.com:SMATAR/laravel-settings.git
Cloning into '/var/www/html/prod/web/vendor/smatar/laravel-settings'...
Warning: Permanently added the RSA host key for IP address '18.228.67.229' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Package deleted from github: https://github.com/SMATAR/laravel-settings
Packagist page for package: https://packagist.org/packages/smatar/laravel-settings
You must contact with package publisher.

Why I can't create laravel projects anymore?

I am working on a local server on my windows os,
I used to be able to create new laravel projects normally, but now I keep getting errors like these:
C:\xampp\htdocs>laravel new blog
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 70 installs, 0 updates, 0 removals
- Installing doctrine/inflector (v1.3.0): Downloading (failed)
Downloading (failed)
Downloading (failed) Failed to download doctrine/inflector from dist: The "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Now trying to download from source
- Installing doctrine/inflector (v1.3.0): Cloning 5527a48b73 from cache
sure your internet connection not have problem in speed
so check your firewall not blocked api.github.com url

Laravel Error :

I'm trying to setup laravel in my Windows system. I've installed composer. But there are some issues with the composer that is creating problems while trying to create a new laravel project.
I did a composer diagnose from the cmd and following are the results:
composer diagnose
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Laravel Error:
new laravel_demo_1
Crafting application...
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 59 installs, 0 updates, 0 removals
- Installing doctrine/inflector (v1.1.0): Downloading (failed)
Downloading (failed)
Downloading (failed) Failed to download doctrine/inflector from dist: The "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Now trying to download from source
- Installing doctrine/inflector (v1.1.0): Cloning 90b2128806 from cache
- Installing erusev/parsedown (1.6.1): Downloading (failed)
Downloading (failed)
Downloading (failed) Failed to download erusev/parsedown from dist: The "https://api.github.com/repos/erusev/parsedown/zipball/20ff8bbb57205368b4b42d094642a3e52dac85fb" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:......
It seems you are simply hitting Github limits due to non authenticated access.
[Composer\Downloader\TransportException] The
"https://api.github.com/rate_limit" file could not be downloaded: SSL
operation failed with code 1. OpenSSL Error messages:
so it should be sufficient to just authenticate yourself:
Log into your GitHub account and click on "Applications" in the sidebar
Create a new token under the "Personal Access Tokens"
in project's folder do:
composer config github-oauth.github.com YOUR-TOKEN
and that should be it.

Cannot install laravel/socialite using composer behind proxy

I'm using win7x64.
I can install laravel using composer when I'm not behind proxy, but when I'm behind proxy I cannot install anything using composer.
I tried install laravel/socialite I receive error:
The
"http://packagist.org/p/provider-2013$64cefc090dc586bcea264a3e17529dfa29b16b
2bf50c52626562f13772982949.json" file could not be downloaded: failed
to open st ream: HTTP request failed! http://packagist.org could not
be fully loaded, package information was loaded f rom the local cache
and may be out of date
[Composer\Downloader\TransportException] The
"http://packagist.org/p/laravel/socialite$d9a828b00026fe40a14532c7f93e7
adc78725a74da02a035cd267618876c312a.json" file could not be
downloaded: fai led to open stream: HTTP request failed!
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress]
[--no-update] [--update-no-dev] [--update-with-dependencies]
[--ignore-platform-reqs] [--sort- packages] [packages1] ...
[packagesN]
I have http_proxy and https_proxy env setup.
composer selfupdate is working
but
composer update is not working
Loading composer repositories with package information Updating
dependencies (including require-dev) The
"http://packagist.org/p/provider-2013$64cefc090dc586bcea264a3e17529dfa29b16b
2bf50c52626562f13772982949.json" file could not be downloaded: failed
to open st ream: HTTP request failed! http://packagist.org could not
be fully loaded, package information was loaded f rom the local cache
and may be out of date Nothing to install or update Generating
autoload files Generating optimized class loader
other cli (eg. gem) is working
I have tried
this solution
but it still not working
Here are the composer diag stat:
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: FAIL
[Composer\Downloader\TransportException] The "http://packagist.org/packages.json
" file could not be downloaded: failed to open stream: HTTP request failed!
Checking https connectivity to packagist: OK
Checking HTTP proxy: OK
Checking HTTP proxy support for request_fulluri: FAIL
Unable to assess the situation, maybe packagist.org is down (The "http://packagi
st.org/packages.json" file could not be downloaded: failed to open stream: HTTP
request failed! )
Checking HTTPS proxy support for request_fulluri: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: OK
Is there any setup I missed?
I add this to composer.json
"repositories": [
{
"packagist": false
},
{
"type": "composer",
"url": "https://packagist.org/"
}
],
This solution is from:
https://github.com/composer/composer/issues/1992

Categories