diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php
index 4a2289bd1..8058cb0b3 100644
--- a/src/Composer/Installer.php
+++ b/src/Composer/Installer.php
@@ -367,12 +367,10 @@ class Installer
// doing a full update
}
- if ($this->updateAllowList) {
- if (!$lockedRepository) {
- $this->io->writeError('Cannot update only a partial set of packages without a lock file present.', true, IOInterface::QUIET);
+ if (($this->updateAllowList || $this->updateMirrors) && !$lockedRepository) {
+ $this->io->writeError('Cannot update ' . ($this->updateMirrors ? 'lock file information' : 'only a partial set of packages') . ' without a lock file present. Run `composer update` to generate a lock file.', true, IOInterface::QUIET);
- return 1;
- }
+ return 1;
}
$this->io->writeError('Loading composer repositories with package information');
diff --git a/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test b/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test
index 74007af7b..1738b2a84 100644
--- a/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test
+++ b/tests/Composer/Test/Fixtures/installer/partial-update-without-lock.test
@@ -31,7 +31,7 @@ Partial update without lock file should error
--RUN--
update b/unstable
--EXPECT-OUTPUT--
-Cannot update only a partial set of packages without a lock file present.
+Cannot update only a partial set of packages without a lock file present. Run `composer update` to generate a lock file.
--EXPECT-EXIT-CODE--
1
--EXPECT--