无法安装barryvdh / laravel-dompdf

时间:2019-07-02 06:09:38

标签: php laravel dompdf

我无法使用barryvdh/laravel-dompdf安装composer require barryvdh/laravel-dompdf

我得到的错误是:

  

[无效的参数异常]找不到匹配版本的barryvdh / laravel-dompdf。检查程序包的拼写,版本约束以及程序包的稳定性是否与最低稳定性(dev)相匹配。

因此,为了纠正错误,我在composer.json中加入了barryvdh/laravel-dompdf: master@dev并做了一个composer update。这次它给了我错误:

  

在任何版本中都找不到所请求的软件包barryvdh / laravel-dompdf。包裹名称中可能有错字

下面是我的composer.json:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "guzzlehttp/guzzle": "^6.3",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0",
        "barryvdh/laravel-dompdf": "master@dev"
    },
    "repositories":
    [
        {
          "type": "composer",
          "url": "https:\/\/www.phpclasses.org\/"
        },
        {
          "packagist": false
        }
    ],
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "app/includes",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "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
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

您认为我在这里想念什么?

4 个答案:

答案 0 :(得分:0)

使用

"barryvdh/laravel-dompdf": "^0.8.4",

代替

"barryvdh/laravel-dompdf": "master@dev"

答案 1 :(得分:0)

通常,建议在安装第三方软件包时不要直接编辑composer.json。您可以从文件中删除行"barryvdh/laravel-dompdf": "master@dev",然后从项目根目录运行此命令:

composer require barryvdh/laravel-dompdf

它将安装最新的稳定的第三方软件包,并自动更新composer.jsoncomposer.lock文件。

更新:要解决您的composer.json文件的问题,请将存储库密钥更改为此:

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

答案 2 :(得分:0)

在您的composer.json文件中删除此行

"require": {
    "barryvdh/laravel-dompdf": "master@dev"
}, 

之后,在命令提示符下运行此命令

composer require barryvdh/laravel-dompdf

这还将下载软件包以及dompdf + fontlib库。这将为您的项目生成最新版本

请检查以下内容:Creating a summation formula in R

答案 3 :(得分:0)

从我的composer.json中删除存储库部分后,安装了该软件包。

谢谢大家的帮助