Skip to content

Commit e8dd0ae

Browse files
authored
don't need node when --backend_only is used (#4641)
1 parent cb24492 commit e8dd0ae

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

reflex/reflex.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,9 @@ def deploy(
519519
if prerequisites.needs_reinit(frontend=True):
520520
_init(name=config.app_name, loglevel=loglevel)
521521
prerequisites.check_latest_package_version(constants.ReflexHostingCLI.MODULE_NAME)
522-
522+
extra: dict[str, str] = (
523+
{"config_path": config_path} if config_path is not None else {}
524+
)
523525
hosting_cli.deploy(
524526
app_name=app_name,
525527
export_fn=lambda zip_dest_dir,
@@ -545,7 +547,7 @@ def deploy(
545547
loglevel=type(loglevel).INFO, # type: ignore
546548
token=token,
547549
project=project,
548-
config_path=config_path,
550+
**extra,
549551
)
550552

551553

reflex/utils/processes.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from redis.exceptions import RedisError
1818

1919
from reflex import constants
20+
from reflex.config import environment
2021
from reflex.utils import console, path_ops, prerequisites
2122

2223

@@ -156,24 +157,30 @@ def new_process(args, run: bool = False, show_logs: bool = False, **kwargs):
156157
Raises:
157158
Exit: When attempting to run a command with a None value.
158159
"""
159-
node_bin_path = str(path_ops.get_node_bin_path())
160-
if not node_bin_path and not prerequisites.CURRENTLY_INSTALLING_NODE:
161-
console.warn(
162-
"The path to the Node binary could not be found. Please ensure that Node is properly "
163-
"installed and added to your system's PATH environment variable or try running "
164-
"`reflex init` again."
165-
)
160+
# Check for invalid command first.
166161
if None in args:
167162
console.error(f"Invalid command: {args}")
168163
raise typer.Exit(1)
169-
# Add the node bin path to the PATH environment variable.
164+
165+
path_env: str = os.environ.get("PATH", "")
166+
167+
# Add node_bin_path to the PATH environment variable.
168+
if not environment.REFLEX_BACKEND_ONLY.get():
169+
node_bin_path = str(path_ops.get_node_bin_path())
170+
if not node_bin_path and not prerequisites.CURRENTLY_INSTALLING_NODE:
171+
console.warn(
172+
"The path to the Node binary could not be found. Please ensure that Node is properly "
173+
"installed and added to your system's PATH environment variable or try running "
174+
"`reflex init` again."
175+
)
176+
path_env = os.pathsep.join([node_bin_path, path_env])
177+
170178
env: dict[str, str] = {
171179
**os.environ,
172-
"PATH": os.pathsep.join(
173-
[node_bin_path if node_bin_path else "", os.environ["PATH"]]
174-
), # type: ignore
180+
"PATH": path_env,
175181
**kwargs.pop("env", {}),
176182
}
183+
177184
kwargs = {
178185
"env": env,
179186
"stderr": None if show_logs else subprocess.STDOUT,

0 commit comments

Comments
 (0)