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

Resolve npm path and fnm path on Windows #2015

Merged
merged 1 commit into from
Oct 23, 2023
Merged
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
11 changes: 8 additions & 3 deletions reflex/utils/prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_install_package_manager() -> str | None:
"""
# On Windows, we use npm instead of bun.
if constants.IS_WINDOWS:
return path_ops.get_npm_path()
return get_package_manager()

# On other platforms, we use bun.
return get_config().bun_path
Expand All @@ -96,7 +96,10 @@ def get_package_manager() -> str | None:
Returns:
The path to the package manager.
"""
return path_ops.get_npm_path()
npm_path = path_ops.get_npm_path()
if npm_path is not None:
npm_path = str(Path(npm_path).resolve())
return npm_path


def get_app(reload: bool = False) -> ModuleType:
Expand Down Expand Up @@ -411,11 +414,13 @@ def install_node():

if constants.IS_WINDOWS:
# Install node
fnm_exe = Path(constants.Fnm.EXE).resolve()
fnm_dir = Path(constants.Fnm.DIR).resolve()
process = processes.new_process(
[
"powershell",
"-Command",
f'& "{constants.Fnm.EXE}" install {constants.Node.VERSION} --fnm-dir "{constants.Fnm.DIR}"',
f'& "{fnm_exe}" install {constants.Node.VERSION} --fnm-dir "{fnm_dir}"',
],
)
else: # All other platforms (Linux, MacOS).
Expand Down
Loading