Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflex installs Bun even though BUN_PATH is set #3791

Open
n0r1z0 opened this issue Aug 14, 2024 · 3 comments · May be fixed by #4688
Open

Reflex installs Bun even though BUN_PATH is set #3791

n0r1z0 opened this issue Aug 14, 2024 · 3 comments · May be fixed by #4688
Assignees
Labels
bug Something isn't working

Comments

@n0r1z0
Copy link

n0r1z0 commented Aug 14, 2024

Describe the bug
Reflex installs Bun even though BUN_PATH is set.

To Reproduce

  1. Install Bun manually. However, the version of Bun is different from constants.Bun.VERSION.
  2. Set an environment variable BUN_PATH as the installed bun path.
  3. Run reflex init.

Expected behavior
The installation of Bun would be skipped.

Additional context
The condition of Bun installation seems incorrect.

Current implementation:

# Skip if bun is already installed.
if os.path.exists(get_config().bun_path) and get_bun_version() == version.parse(
constants.Bun.VERSION
):
console.debug("Skipping bun installation as it is already installed.")
return

I suppose this should be changed as below:

# Skip if bun is already installed.
bun_path = get_config().bun_path
if bun_path != constants.Bun.DEFAULT_PATH or os.path.exists(bun_path) and get_bun_version() == version.parse(
    constants.Bun.VERSION
):
    console.debug("Skipping bun installation as it is already installed.")
    return
@n0r1z0 n0r1z0 added the bug Something isn't working label Aug 14, 2024
@Lendemor
Copy link
Collaborator

PR #4006 is introducing REFLEX_USE_SYSTEM_BUN as an env var.
Let us know if this solve the issue for you.

@n0r1z0
Copy link
Author

n0r1z0 commented Oct 23, 2024

@Lendemor
Thank you for your response.

There seems to be a new bug in prerequisites.get_bun_version.

The version of Bun is resolved at following code, but REFLEX_USE_SYSTEM_BUN is not considered.

bun_version = get_bun_version()

result = processes.new_process([str(get_config().bun_path), "-v"], run=True)

Compared to prerequisites.get_node_version, it seems that path_ops.get_bun_path() should be used instead of get_config().bun_path.

node_path = path_ops.get_node_path()

@Lendemor Lendemor self-assigned this Jan 24, 2025
@Lendemor Lendemor linked a pull request Jan 24, 2025 that will close this issue
@Lendemor
Copy link
Collaborator

Sorry for the delay in getting back to you on this.

Made a PR that should fix the issue with bun_path, let me know if you can give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants