Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What if I don't want to do composer update, I just want to use what ever in composer.json and composer.lock

I have an old composer based symfony project, that I just updated with some changes of code. I tested in development everything works fine. I have got issue when deploying the composer asked to run composer.phar self-update to update the composer since the composer is outdated. After that I do the composer.phar install. I get this error -

[RuntimeException]                                                                                                            
Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.

What if I don't want to update. I am okay this. How can I force it not to update.

like image 416
Suracheth Chawla Avatar asked Mar 29 '13 09:03

Suracheth Chawla


People also ask

Does composer require update the lock file?

As mentioned above, the composer.lock file prevents you from automatically getting the latest versions of your dependencies. To update to the latest versions, use the update command. This will fetch the latest matching versions (according to your composer.json file) and update the lock file with the new versions.

What is the difference between composer install and composer update?

composer install is primarily used in the 'deploying phase' to install our application on a production server or on a testing environment, using the same dependencies stored in the composer. lock file created by composer update.

What is difference between composer json and composer lock?

You see, while your composer. json file is a rough guide to the dependency versions that Composer should install, the composer. lock file is an exact record of the dependency versions that have been installed. That's right, it's recording what Composer has installed for you, right down to the commit hash.

How do I update my composer version to a specific version?

To change to version one run the self-update command and pass in the –1 flag. This will change composer to version one and now you can install your dependencies. Once you have installed your dependencies, now you can run the same command and pass in –2 as the flag and this will switch back to composer version 2.


2 Answers

The structure of the lock file was changed, and therefor you should upgrade your lock file. You can upgrade your lock file without actually upgrading any dependencies by executing:

composer update nothing

like image 116
Gerry Avatar answered Oct 16 '22 08:10

Gerry


I would suggest you look at the composer.lock file and note any versions that are used there. Then copy these into the composer.json, delete the lock file and run a normal install.

Of course, you do this on a copy of your software to see if all the same versions do appear again.

like image 33
Sven Avatar answered Oct 16 '22 07:10

Sven