0

I am using ubuntu 18.04 and laravel 5.4. When I upgrade Laravel using the following command:

composer update

I am getting the following error:

[Composer\Downloader\TransportException]
The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Connection timed out

Is it an SSL issue or something else? Please guide me.

My composer.json is

{
  "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
  }
}
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Adnan Khan
  • 897
  • 5
  • 14
  • 23

1 Answers1

0

Could just be an internet slowness issue. But more likely it is an issue caused by a redirect from http to https. There are a few helpful sources out there for this, but the most helpful solve I've seen is to add this to your composer file, which essentially disables the default packagist configuration and adds your own repo:

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

Give it a try :)

A different approach to solve, if this doesn't work is here: SO answer

Watercayman
  • 7,970
  • 10
  • 31
  • 49