我使用的是Laravel 5.4,我的作曲家版本是1.4.1。
我尝试安装包composer require 'name package'
但总是失败。
C:\xampp\htdocs\dhuha_service_admin>composer require intervention/image -vvv
Reading ./composer.json
Loading config file C:/Users/owner/AppData/Roaming/Composer/config.json
Loading config file C:/Users/owner/AppData/Roaming/Composer/auth.json
Loading config file ./composer.json
Checked CA file C:\Users\owner\AppData\Local\Temp\composer-cacert-e62a07e61e5870effa81b430e1900778943c228bd7da1259dd6a955ee2262b47.pem: valid
Executing command (C:\xampp\htdocs\dhuha_service_admin): git branch --no-color --no-abbrev -v
Executing command (C:\xampp\htdocs\dhuha_service_admin): git describe --exact-match --tags
Executing command (C:\xampp\htdocs\dhuha_service_admin): git log --pretty="%H" -n1 HEAD
Executing command (C:\xampp\htdocs\dhuha_service_admin): hg branch
Executing command (C:\xampp\htdocs\dhuha_service_admin): fossil branch list
Executing command (C:\xampp\htdocs\dhuha_service_admin): fossil tag list
Executing command (C:\xampp\htdocs\dhuha_service_admin): svn info --xml
Reading C:/Users/owner/AppData/Roaming/Composer/composer.json
Loading config file C:/Users/owner/AppData/Roaming/Composer/config.json
Loading config file C:/Users/owner/AppData/Roaming/Composer/auth.json
Loading config file C:/Users/owner/AppData/Roaming/Composer/composer.json
Loading config file C:\Users\owner\AppData\Roaming\Composer/auth.json
Reading C:\Users\owner\AppData\Roaming\Composer/auth.json
Reading C:\xampp\htdocs\dhuha_service_admin/vendor/composer/installed.json
Reading C:/Users/owner/AppData/Roaming/Composer/vendor/composer/installed.json
Running 1.4.1 (2017-03-10 09:29:45) with PHP 5.6.12 on Windows NT / 10.0
Downloading https://packagist.org/packages.json
Writing C:/Users/owner/AppData/Local/Composer/repo/https---packagist.org/packages.json into cache
Reading C:/Users/owner/AppData/Local/Composer/repo/https---packagist.org/p-provider-2013.json from cache
Reading C:/Users/owner/AppData/Local/Composer/repo/https---packagist.org/p-provider-2014.json from cache
Downloading https://packagist.org/p/provider-2015%24c825dba6ea97350c3a10e76223062d4cba03d75a1d4383b5d05ba69fb5185f04.json
Writing C:/Users/owner/AppData/Local/Composer/repo/https---packagist.org/p-provider-2015.json into cache
Reading C:/Users/owner/AppData/Local/Composer/repo/https---packagist.org/p-provider-2016.json from cache
Downloading https://packagist.org/p/provider-2016-04%243c63bda82e7264704dfb6ea97ca8ebb7a8f2e6fd44760f91fdc07d97e903a674.json
Writing C:/Users/owner/AppData/Local/Composer/repo/https---packagist.org/p-provider-2016-04.json into cache
Reading C:/Users/owner/AppData/Local/Composer/repo/https---packagist.org/p-provider-2016-07.json from cache
Downloading https://packagist.org/p/provider-2016-10%24145b9d3fe5c71b37120568e1af00aef894ac7def81190d575b9a3bb47e80b31d.json
Downloading https://packagist.org/p/provider-2016-10%24145b9d3fe5c71b37120568e1af00aef894ac7def81190d575b9a3bb47e80b31d.json
[Composer\Downloader\TransportException]
The "https://packagist.org/p/provider-2016-10%24145b9d3fe5c71b37120568e1af00aef894ac7def81190d575b9a3bb47e80b31d.json" file could not be downloaded (HTTP/1.1 404 Not Found)
Exception trace:
() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:365
Composer\Util\RemoteFilesystem->get() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/RemoteFilesystem.php:101
Composer\Util\RemoteFilesystem->getContents() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:661
Composer\Repository\ComposerRepository->fetchFile() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:573
Composer\Repository\ComposerRepository->loadProviderListings() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Repository/ComposerRepository.php:296
Composer\Repository\ComposerRepository->whatProvides() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:204
Composer\DependencyResolver\Pool->computeWhatProvides() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:193
Composer\DependencyResolver\Pool->whatProvides() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Package/Version/VersionSelector.php:52
Composer\Package\Version\VersionSelector->findBestCandidate() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/InitCommand.php:634
Composer\Command\InitCommand->findBestVersionForPackage() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/InitCommand.php:365
Composer\Command\InitCommand->determineRequirements() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/RequireCommand.php:117
Composer\Command\RequireCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Command/Command.php:267
Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:846
Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:191
Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:227
Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:122
Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:100
Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:54
require() at C:\ProgramData\ComposerSetup\bin\composer.phar:24
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
C:\xampp\htdocs\dhuha_service_admin>
我使用composer diagnose
检查了我的作曲家,我认为没有错:
C:\xampp\htdocs\dhuha_service_admin>composer diagnose
Checking composer.json: OK
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
我也尝试安装laravelcollective/html
,结果相同。
我该怎么做才能解决这个问题?
提前谢谢。
[UPDATE]
当我再次尝试安装时,错误现在更改为content-length mismatch
(我不知道为什么,有时我收到错误&#39;无法打开流http&#39;但主要是我得到内容长度错误)。我试图添加
"repositories": [
{
"type": "composer",
"url": "https://packagist.org"
},
{ "packagist": false }
]
但它仍然无法正常工作
答案 0 :(得分:0)
尽管我不是这方面的专家,但是我已经搜索了一些东西。 尝试执行以下命令:
清除作曲家缓存
作曲家清除缓存
更新作曲家
作曲者自我更新
执行这两个命令
composer config -g repo.packagist作曲家https://packagist.org composer config -g github-protocols https ssh
如果它不起作用,请尝试以下方法:
清除作曲家缓存
作曲家清除缓存
更新作曲家(第二次可以避免)
作曲者自我更新
主服务器 https://packagist.org 上似乎有时会出现一些网络问题。然后使用镜像作为临时解决方法。执行以下命令:
composer config -g repo.packagist composer https?://packagist.jp
(速度慢,但可能会起作用。)