Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions reflex/utils/js_runtimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,17 +463,16 @@ def _run_initial_install(primary_package_manager: str, env: dict) -> None:

bun reports ``error: lockfile had changes, but lockfile is frozen`` when
the persisted lockfile cannot satisfy the recovered package.json. When
that happens, point the user at ``reflex.lock/package.json`` so they can
delete it and let Reflex regenerate the dep set from scratch on the
next run.
that happens, point the user at ``reflex.lock`` so they can delete it and
let Reflex regenerate the dep set from scratch on the next run.

Args:
primary_package_manager: Path to the package manager executable.
env: Extra environment variables for the subprocess.

Raises:
SystemExit: If the install fails. The exit message tells the user
how to recover from a frozen-lockfile mismatch when applicable.
SystemExit: If the install fails. The exit message tells the user how
to recover from a frozen-lockfile mismatch when applicable.
"""
install_args = [
primary_package_manager,
Expand All @@ -499,7 +498,9 @@ def _run_initial_install(primary_package_manager: str, env: dict) -> None:
if process.returncode == 0:
return

if any("lockfile had changes, but lockfile is frozen" in line for line in logs):
if any(
"lockfile had changes, but lockfile is frozen" in line for line in logs
):
root_dir = Path.cwd() / constants.Bun.ROOT_LOCKFILE_DIR
console.error(
"The persisted lockfile is out of sync with the recovered "
Expand Down
6 changes: 4 additions & 2 deletions tests/units/test_prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,10 @@ def run_package_manager(args, **kwargs):


@pytest.mark.usefixtures("install_packages_env")
def test_run_initial_install_frozen_lockfile_error_helpful_message(monkeypatch, capsys):
"""A frozen-lockfile mismatch surfaces a 'delete reflex.lock/package.json' hint."""
def test_run_initial_install_frozen_lockfile_error_helpful_message(
monkeypatch, capsys
):
"""A frozen-lockfile mismatch tells the user how to regenerate from scratch."""

class _FakeProcess:
returncode = 1
Expand Down