Issue
Some dependencies were mistakenly added to require
instead of require-dev
. I tried manually changing composer.json
and running composer install
, but composer.lock
wasn't changed. So my guess is, that it ignored changes in composer.json
, and just ensured that what's installed reflects what's in composer.lock
file. Am I wrong here? If not wrong, how do I do that? I'd like to preserve versions of packages in composer.lock
file as they are now as much as possible.
Solution
I have reproduced your problem and found a simple solution: composer update
.
The following are the steps I have done.
Old composer.json
{
"require": {
"meenie/javascript-packer": "1.1"
}
}
$ composer install
Saved a backup for composer.lock
for further comparison:
$ cp composer.lock composer.lock-prev
New composer.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
I have updated Composer as the output above suggested:
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
Then looked at the differences between the old and new versions of 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": [],
We can see that the changes are actually applied after running composer update
.
Answered By - Ruslan Osmanov Answer Checked By - Robin (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.