无法下载“ https://packagist.org/packages.json”文件:打开流失败:连接超时

时间:2019-05-13 22:46:08

标签: laravel ubuntu openssl upgrade

我正在使用ubuntu 18.04和laravel 5.4。当我使用以下命令升级Laravel时:

composer update

我遇到以下错误:

  

[Composer \ Downloader \ TransportException]
  无法使用“ https://packagist.org/packages.json”文件   下载:无法打开流:连接超时

是SSL问题还是其他问题?请引导我。

我的composer.json是

{
  "name": "laravel/laravel",
  "description": "The Laravel Framework.",
  "keywords": [
    "framework",
    "laravel"
  ],
  "license": "MIT",
  "type": "project",
  "require": {
    "php": ">=7.0.0",
    "aws/aws-sdk-php": "~3.0",
    "barryvdh/laravel-debugbar": "~2.4",
    "barryvdh/laravel-snappy": "^0.4.0",
    "doctrine/dbal": "^2.9",
    "h4cc/wkhtmltoimage-amd64": "0.12.x",
    "h4cc/wkhtmltopdf-amd64": "0.12.x",
    "imal-h/pdf-box": "^1.2",
    "intervention/image": "^2.4",
    "khanamiryan/qrcode-detector-decoder": "^1.0",
    "laracasts/Presenter": "^0.2.1",
    "laravel/framework": "5.5.*",
    "laravel/passport": "^4.0",
    "laravel/socialite": "^3.0",
    "laravel/tinker": "~1.0",
    "laravelcollective/html": "^5.4.0",
    "league/flysystem-aws-s3-v3": "^1.0",
    "league/fractal": "^0.17.0",
    "maatwebsite/excel": "^2.1",
    "predis/predis": "~1.0",
    "pusher/pusher-php-server": "~2.6",
    "ralouphie/mimey": "^1.0",
    "vinkla/hashids": "3.1.0",
    "zizaco/entrust": "dev-master"
  },
  "require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~6.0",
    "filp/whoops": "~2.0"   
  },
  "autoload": {
    "classmap": [
      "database/seeds",
      "database/factories"
    ],
    "psr-4": {
      "App\\": "app/"
    },
    "files": [
      "app/Helpers/helpers.php"
    ]
  },
  "autoload-dev": {
    "psr-4": {
      "Tests\\": "tests/"
    }
  },
  "scripts": {
    "post-root-package-install": [
      "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
      "@php artisan key:generate"
    ],

    "post-autoload-dump": [
      "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
      "php artisan package:discover"
    ]
  },
  "config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
  }
}

1 个答案:

答案 0 :(得分:0)

可能只是互联网缓慢问题。但是更有可能是由http重定向到https引起的问题。那里有一些有用的资源,但是我见过的最有用的解决方案是将其添加到您的composer文件中,这实际上会禁用默认的packagist配置并添加您自己的存储库:

 "repositories": [
  {
     "type": "composer", 
     "url": "https://packagist.org"
  },
  { "packagist": false }
] 

试试看:)

如果此方法不起作用,则可以采用以下另一种解决方法:SO answer