当我跑的时候
composer require --dev phpunit/phpunit我得到以下消息:
composer require --dev phpunit/phpunit
Using version ^6.2 for phpunit/phpunit
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for sebastian/object-enumerator (locked at 2.0.1) -> satisfiable by sebastian/object-enumerator[2.0.1].
- phpunit/phpunit 6.2.0 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- phpunit/phpunit 6.2.1 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- phpunit/phpunit 6.2.2 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- phpunit/phpunit 6.2.3 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- Conclusion: don't install sebastian/object-enumerator 3.0.2
- Installation request for phpunit/phpunit ^6.2 -> satisfiable by phpunit/phpunit[6.2.0, 6.2.1, 6.2.2, 6.2.3].
Installation failed, reverting ./composer.json to its original content.以下是我的composer json文件:
"require": {
"php": "^7.0",
"laravel/framework": "^5.4",
"guzzlehttp/guzzle": "^6.3",
"symfony/psr-http-message-bridge": "^1.0",
"mcamara/laravel-localization": "^1.2",
"laravelcollective/html": "^5.4",
"laravel/socialite": "^3.0",
"yajra/laravel-datatables-oracle": "^7.9"
},
"require-dev": {
"fzaninotto/faker": "^1.6",
"symfony/css-selector": "^3.3",
"symfony/dom-crawler": "^3.3"
}我尝试从上面的5.4版本获取,总是得到类似的错误,但对于其他依赖项,似乎唯一有效的版本是5.0
发布于 2017-09-09 05:56:47
跑
$ composer require --dev phpunit/phpunit --update-with-dependencies请参阅https://getcomposer.org/doc/03-cli.md#require
--update-with-dependencies:
还会更新新需要的包的依赖关系。
注释在这种情况下删除composer.lock并不是最好的主意,因为它可能会引入依赖项,从而在其他地方破坏您的代码。你真的希望一次只更新一个特定的依赖项,而不是一次更新所有依赖项。
发布于 2017-07-18 02:49:36
如果在composer.lock文件和vendor文件夹存在的情况下运行composer update,Composer将在更新之前将已安装的版本纳入帐户。
确保您已将锁定文件提交到项目存储库中,以便能够恢复当前版本。然后尝试另一个更新,但在此之前删除锁定文件和供应商文件夹。
我的经验是,这样的更新不会受到已经安装的版本的影响,这可能会阻止必要的更新。
调试依赖项的另一个选择是使用composer why-not phpunit/phpunit 6.2.0 (使用您知道存在的显式版本-如果没有版本,命令的输出就没有意义)。Composer将为您提供阻止更新的依赖项列表,以供您进一步调查。
https://stackoverflow.com/questions/45146515
复制相似问题