Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

composer is not removing entry from composer.lock

Tags:

composer-php

I've used following command to remove a package using composer.

composer remove sjparkinson/static-review

Above command removes entry from composer.json file but composer.lock file still contains entry for mentioned library in require section.

What is the proper way to update composer.lock ? Should I update it manually?

like image 395
amitshree Avatar asked May 14 '18 13:05

amitshree


People also ask

How do I update my composer lock file?

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.

Should composer lock be ignored?

If you're concerned about your code breaking, you should commit the composer. lock to your version control system to ensure all your project collaborators are using the same version of the code. Without a lock file, you will get new third-party code being pulled down each time.


1 Answers

Composer does not removing this package, because it is required by another dependency. So even if you don't require it directly, it is still required by your project, so you cannot remove it. You can use composer why some-vendor/some-package command to check what is the reason to keep this package installed:

composer why sjparkinson/static-review

magento/product-community-edition 2.2.4 requires sjparkinson/static-review (~4.1)

If you really want to remove this package, you need to remove magento/product-community-edition too (and every dependency, which depends on this package).


BTW: Editing composer.lock manually is really bad idea, you should never do that.

like image 169
rob006 Avatar answered Oct 17 '22 04:10

rob006