Skip to content

Commit 7286076

Browse files
authored
attempt to fix usage when volta is installing node (#4664)
* attempt to fix usage when volta is installing node * use absolute() instead of resolve() * fix stuff
1 parent a923f65 commit 7286076

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

reflex/utils/path_ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def get_node_path() -> str | None:
174174
return str(node_path)
175175

176176

177-
def get_npm_path() -> str | None:
177+
def get_npm_path() -> Path | None:
178178
"""Get npm binary path.
179179
180180
Returns:
@@ -183,8 +183,8 @@ def get_npm_path() -> str | None:
183183
npm_path = Path(constants.Node.NPM_PATH)
184184
if use_system_node() or not npm_path.exists():
185185
system_npm_path = which("npm")
186-
return str(system_npm_path) if system_npm_path else None
187-
return str(npm_path)
186+
npm_path = Path(system_npm_path) if system_npm_path else None
187+
return npm_path.absolute() if npm_path else None
188188

189189

190190
def update_json_file(file_path: str | Path, update_dict: dict[str, int | str]):

reflex/utils/prerequisites.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def get_package_manager(on_failure_return_none: bool = False) -> str | None:
254254
"""
255255
npm_path = path_ops.get_npm_path()
256256
if npm_path is not None:
257-
return str(Path(npm_path).resolve())
257+
return str(npm_path)
258258
if on_failure_return_none:
259259
return None
260260
raise FileNotFoundError("NPM not found. You may need to run `reflex init`.")

reflex/utils/processes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import signal
1010
import subprocess
1111
from concurrent import futures
12-
from pathlib import Path
1312
from typing import Callable, Generator, List, Optional, Tuple, Union
1413

1514
import psutil
@@ -368,7 +367,7 @@ def get_command_with_loglevel(command: list[str]) -> list[str]:
368367
The updated command list
369368
"""
370369
npm_path = path_ops.get_npm_path()
371-
npm_path = str(Path(npm_path).resolve()) if npm_path else npm_path
370+
npm_path = str(npm_path) if npm_path else None
372371

373372
if command[0] == npm_path:
374373
return [*command, "--loglevel", "silly"]

0 commit comments

Comments
 (0)