无法运行composer安装

ben*_*r78 9 php ubuntu composer-php

我正在尝试在我的项目中运行composer install但是我有以下错误

[Composer\Downloader\TransportException]
The "http://packagist.org/p/provider-2013$43e3f41fbe30a46245103451248f688a727f076a6e90636d19a69a156c17a416.json" file could not be downloaded (HTTP/1.1 400 Received invalid request from Client)
Run Code Online (Sandbox Code Playgroud)

我试图运行composer自我更新并出现此错误

[Composer\Downloader\TransportException]
The "https://getcomposer.org/version" file could not be downloaded: Failed to enable crypto failed to open stream: operation failed
Run Code Online (Sandbox Code Playgroud)

我用代理后面的apache/php5.6.4/mysql运行Ubuntu 15.04.

我试过下载http://curl.haxx.se/ca/cacert.pem并用以下内容更新我的php.ini文件

curl.cainfo=/etc/ssl/certs/cacert.pem
openssl.cafile=/etc/ssl/certs/cacert.pem
openssl.capath=/etc/ssl/certs
Run Code Online (Sandbox Code Playgroud)

运行composer diagnose会返回此信息

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 (HTTP/1.1 400 Received invalid request from Client)
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://packagist.org/packages.json" file could not be downloaded (HTTP/1.1 400 Received invalid request from Client))
Checking HTTPS proxy support for request_fulluri: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking composer version: FAIL
You are not running the latest version
Run Code Online (Sandbox Code Playgroud)

最后openssl_get_cert_locations()返回

  • default_cert_file:/usr/lib/ssl/cert.pem
  • default_cert_file_env:SSL_CERT_FILE
  • default_cert_dir:/ usr/lib/ssl/certs
  • default_cert_dir_env:SSL_CERT_DIR
  • default_private_dir:/ usr/lib/ssl/private
  • default_default_cert_area:/ usr/lib/ssl
  • ini_cafile:/etc/ssl/certs/cacert.pem
  • ini_capath:/ etc/ssl/certs

我完全失去了什么是错的,甚至更多我如何调试这个.

我希望有人可以帮助我!

小智 6

和你一样 我找到了在互联网上解决此问题的方法(针对窗口10)。1-转到文件夹 PATH\xampp\apache并运行makecert.bat 2-将此脚本添加到composer.json文件

"repositories": [
        {
            "type": "composer",
            "url": "https://packagist.org"
        },
        {
            "packagist": false
        }
    ]
Run Code Online (Sandbox Code Playgroud)

  • 谢谢,你救了我!我花了2个晚上在愚蠢的Windows 10机器上获取此问题的解决方案,直到现在都没有希望。我将在网络上传播您的答案,希望它能对其他人有所帮助。 (2认同)

Rac*_*ler 0

也许你可以尝试更改你的代理。

http://composer-proxy.jp/

这是来自日本的代理。希望对你有帮助。