diff --git a/poetry/console/commands/export.py b/poetry/console/commands/export.py
index a58d96f50fe..accdc199460 100644
--- a/poetry/console/commands/export.py
+++ b/poetry/console/commands/export.py
@@ -41,7 +41,7 @@ def handle(self) -> None:
locker = self.poetry.locker
if not locker.is_locked():
- self.line("The lock file does not exist. Locking.")
+ self.line_error("The lock file does not exist. Locking.")
options = []
if self.io.is_debug():
options.append(("-vvv", None))
@@ -53,7 +53,7 @@ def handle(self) -> None:
self.call("lock", " ".join(options))
if not locker.is_fresh():
- self.line(
+ self.line_error(
""
"Warning: The lock file is not up to date with "
"the latest changes in pyproject.toml. "
diff --git a/tests/console/commands/test_export.py b/tests/console/commands/test_export.py
index f5b9fba4a7d..0c4efc2e45e 100644
--- a/tests/console/commands/test_export.py
+++ b/tests/console/commands/test_export.py
@@ -77,12 +77,12 @@ def _export_requirements(tester, poetry):
def test_export_exports_requirements_txt_file_locks_if_no_lock_file(tester, poetry):
assert not poetry.locker.lock.exists()
_export_requirements(tester, poetry)
- assert "The lock file does not exist. Locking." in tester.io.fetch_output()
+ assert "The lock file does not exist. Locking." in tester.io.fetch_error()
def test_export_exports_requirements_txt_uses_lock_file(tester, poetry, do_lock):
_export_requirements(tester, poetry)
- assert "The lock file does not exist. Locking." not in tester.io.fetch_output()
+ assert "The lock file does not exist. Locking." not in tester.io.fetch_error()
def test_export_fails_on_invalid_format(tester, do_lock):