安装laravel突然一些json文件无法下载

时间:2018-01-15 14:03:35

标签: php json laravel composer-php

我输入create-project laravel/laravel "foldername"并收到此消息:

  

[Composer \ Downloader \ TransportException]   “http://packagist.org/p/illuminate/console%241d2f57f687204b9a57e5848fe9f49e79bc2fb7ed0cafc6d1387ad4760a1b155c.json”   无法下载文件(HTTP / 1.1 404 Not Found)

这是为了什么?我已经获得了laravel结构文件,但我不想在不知道这个错误的情况下继续。

更新: 我的laravel文件夹结构下的composer.json内容

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=5.6.4",
    "laravel/framework": "5.4.*",
    "laravel/tinker": "~1.0"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~5.7"
},
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},
"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-install-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postInstall",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "php artisan optimize"
    ]
},
"config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
}

}

2 个答案:

答案 0 :(得分:2)

在你的作曲家上添加:

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

再次运行composer:update。如果没有,则运行composer self-update

答案 1 :(得分:1)

这在Linux上对我有用。它将ipv4优先于ipv6。

sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"