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

attempt to fix usage when volta is installing node #4664

Merged
merged 3 commits into from
Jan 22, 2025
Merged
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
6 changes: 3 additions & 3 deletions reflex/utils/path_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def get_node_path() -> str | None:
return str(node_path)


def get_npm_path() -> str | None:
def get_npm_path() -> Path | None:
"""Get npm binary path.

Returns:
Expand All @@ -183,8 +183,8 @@ def get_npm_path() -> str | None:
npm_path = Path(constants.Node.NPM_PATH)
if use_system_node() or not npm_path.exists():
system_npm_path = which("npm")
return str(system_npm_path) if system_npm_path else None
return str(npm_path)
npm_path = Path(system_npm_path) if system_npm_path else None
return npm_path.absolute() if npm_path else None


def update_json_file(file_path: str | Path, update_dict: dict[str, int | str]):
Expand Down
2 changes: 1 addition & 1 deletion reflex/utils/prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def get_package_manager(on_failure_return_none: bool = False) -> str | None:
"""
npm_path = path_ops.get_npm_path()
if npm_path is not None:
return str(Path(npm_path).resolve())
return str(npm_path)
if on_failure_return_none:
return None
raise FileNotFoundError("NPM not found. You may need to run `reflex init`.")
Expand Down
3 changes: 1 addition & 2 deletions reflex/utils/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import signal
import subprocess
from concurrent import futures
from pathlib import Path
from typing import Callable, Generator, List, Optional, Tuple, Union

import psutil
Expand Down Expand Up @@ -368,7 +367,7 @@ def get_command_with_loglevel(command: list[str]) -> list[str]:
The updated command list
"""
npm_path = path_ops.get_npm_path()
npm_path = str(Path(npm_path).resolve()) if npm_path else npm_path
npm_path = str(npm_path) if npm_path else None

if command[0] == npm_path:
return [*command, "--loglevel", "silly"]
Expand Down
Loading