一些依赖项被错误地添加到require而不是require-dev.我尝试手动更改composer.json并运行composer install,但是composer.lock没有更改.所以我的猜测是,它忽略了composer.json中的更改,并确保安装的内容反映了composer.lock文件中的内容.我错了吗?如果没有错,我该怎么做?我想保留composer.lock文件中的软件包版本,因为它们现在尽可能多.
我已经复制了你的问题并找到了一个简单的解决方案:composer update.
以下是我所做的步骤.
老composer.json
{ "require": { "meenie/javascript-packer": "1.1" } } $composer install
保存composer.lock的备份以进行进一步比较:
$cp composer.lock composer.lock-prev
新作曲家.json
{ "require-dev": { "meenie/javascript-packer": "1.1" } } $composer install Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them. Nothing to install or update
我更新了Composer作为上面建议的输出:
$composer update Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Writing lock file Generating autoload files
然后看看composer.lock的新旧版本之间的差异:
$diff -Nau composer.lock-prev composer.lock --- composer.lock-prev 2016-10-29 19:05:51.331588329 +0700 +++ composer.lock 2016-10-29 19:06:05.639809116 +0700 @@ -4,9 +4,10 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file","This file is @generated automatically" ],- "hash": "f092e6d1418a7bb0db55b75f1099b4eb",- "content-hash": "774f074021977667a459f207616edfe2",- "packages": [ + "hash": "0c81c48f9845635d47821bc0e965e4fe",+ "content-hash": "cb194309c2a3fda3b07a46ed7ef36bdd",+ "packages": [],+ "packages-dev": [ { "name": "meenie/javascript-packer","version": "1.1",@@ -45,7 +46,6 @@ "time": "2013-03-25 21:54:33" } ],- "packages-dev": [],"aliases": [],"minimum-stability": "stable","stability-flags": [],
我们可以看到在运行composer update之后实际应用了这些更改.