Why does my deploy log say `No composer.lock file present` when I really do have a `composer.lock`?
Dan Morrison
I’m deploying a Drupal 8 or 9 site, and although things seem to work OK, my deploy log contains the confusing message:
Changed current directory to /app/.global/composer/composer
W: No composer.lock file present. Updating dependencies to latest instead of installing from lock file.
And composer seems to be running twice.
I have committed a composer.lock file, and that should be getting used.
What’s going on?
0
Comments
Composer is being run twice, and the first time run is not in your application root, that’s why your applications
composer.lockfile is not being used.This first run is a result of adding
composer 2as a PHP dependency , as recommended in the Platform.sh PHP build documentation.When you define a PHP dependency like this, composer gets installed into a location on the system before your own app gets installed.
composer 2then gets used to do your actual application install, as requested.Here, that location is the special directory
/app/.global/./app/global/binis also added to your$PATHso thatcomposerwill get executed from there.This happens even when not specifying a
composerflavored buildThis will also take effect if you chose not to use composer
but still define a PHP dependency, such as
Dependencies get downloaded locally also
This can also be seen when running:
…on your local checkout of your code. In this case, the console will show a message like:
And a local copy of
composerordrushmay be installed into your.platform/local/deps/php/vendor/directory.Note that
.platform/local/deps/php/vendor/binis not automatically added to your local$PATHso these libraries may not be immediately available for use. You may want to resolve that yourself.Please sign in to leave a comment.