Composer require 在安装 barryvdh/laravel-dompdf 时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/48301899/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 17:15:45  来源:igfitidea点击:

Composer require gives errors while installing barryvdh/laravel-dompdf

phplaravelpdf

提问by Franko Hysaj

I'm quite new with laravel and wrote my first app. I'm using Laravel 5.4 with PHP 7.1.5 but when I run the "composer require barryvdh/laravel-dompdf" command, I get following issues. I have followed many "possible solutions" but still it is not working. Oh, BTW, I'm using windows This is the error :

我对 Laravel 很陌生,并编写了我的第一个应用程序。我将 Laravel 5.4 与 PHP 7.1.5 一起使用,但是当我运行“composer require barryvdh/laravel-dompdf”命令时,出现以下问题。我遵循了许多“可能的解决方案”,但仍然无法正常工作。哦,顺便说一句,我正在使用 Windows 这是错误:

Your requirements could not be resolved to an installable set of packages.

无法将您的要求解析为一组可安装的软件包。

Problem 1 - Installation request for barryvdh/laravel-dompdf ^0.8.1 -> satisfiable by barryvdh/laravel-dom pdf[v0.8.1]. - barryvdh/laravel-dompdf v0.8.1 requires dompdf/dompdf ^0.8 -> satisfiable by dompdf/dompdf[v0. 8.0, v0.8.1, v0.8.2] but these conflict with your requirements or minimum-stability.

问题 1 - barryvdh/laravel-dompdf ^0.8.1 的安装请求 -> barryvdh/laravel-dom pdf[v0.8.1] 可满足。- barryvdh/laravel-dompdf v0.8.1 需要 dompdf/dompdf ^0.8 -> 可满足 dompdf/dompdf[v0. 8.0, v0.8.1, v0.8.2] 但这些与您的要求或最低稳定性相冲突。

回答by xyzale

Don't composer update. If you have dompdf/dompdfin your composer.json just update it, specifying 0.8.*as version and running

不要composer update。如果你dompdf/dompdf在 composer.json 中更新它,指定0.8.*版本并运行

composer update dompdf/dompdf

composer update dompdf/dompdf

then

然后

composer require barryvdh/laravel-dompdf

composer require barryvdh/laravel-dompdf

--

——

Running a generic composer updatewill affect all your other dependencies you may want keep as they currently are.

运行泛型composer update将影响您可能希望保持当前状态的所有其他依赖项。

All the changes affected by your composer updatecommand are then recorded in your composer.lock file.

所有受您的composer update命令影响的更改都会记录在您的 composer.lock 文件中。

When you'll move your project somewhere else or you'll deploy it on a server for example, the composer installcommand will read the composer.lock file and will install the exact version of your dependencies which are recorded in it. So you'll be sure about the version of your dependencies.

例如,当您将项目移动到其他地方或将其部署在服务器上时,该composer install命令将读取 composer.lock 文件并安装其中记录的依赖项的确切版本。因此,您将确定依赖项的版本。

回答by Sapnesh Naik

Delete your composer.lockfile and run:

删除您的composer.lock文件并运行:

composer install

回答by Igor Finagin

Check then dompdf/dompdfmay updated e.g. 0.7.*or ~0.7.0

检查然后dompdf/dompdf可以更新例如0.7.*~0.7.0

composer update;
composer require barryvdh/laravel-dompdf;

回答by Muhammad

Run this composer require barryvdh/laravel-dompdf "^0.8.2" .

运行这个 composer require barryvdh/laravel-dompdf "^0.8.2" 。