Skip to content

Commit

Permalink
don't need node when --backend_only is used
Browse files Browse the repository at this point in the history
  • Loading branch information
Lendemor committed Jan 15, 2025
1 parent f69be58 commit 5d49167
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
6 changes: 4 additions & 2 deletions reflex/reflex.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,9 @@ def deploy(
if prerequisites.needs_reinit(frontend=True):
_init(name=config.app_name, loglevel=loglevel)
prerequisites.check_latest_package_version(constants.ReflexHostingCLI.MODULE_NAME)

extra: dict[str, str] = (
{"config_path": config_path} if config_path is not None else {}
)
hosting_cli.deploy(
app_name=app_name,
export_fn=lambda zip_dest_dir,
Expand All @@ -545,7 +547,7 @@ def deploy(
loglevel=type(loglevel).INFO, # type: ignore
token=token,
project=project,
config_path=config_path,
**extra,
)


Expand Down
29 changes: 18 additions & 11 deletions reflex/utils/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from redis.exceptions import RedisError

from reflex import constants
from reflex.config import environment
from reflex.utils import console, path_ops, prerequisites


Expand Down Expand Up @@ -156,24 +157,30 @@ def new_process(args, run: bool = False, show_logs: bool = False, **kwargs):
Raises:
Exit: When attempting to run a command with a None value.
"""
node_bin_path = str(path_ops.get_node_bin_path())
if not node_bin_path and not prerequisites.CURRENTLY_INSTALLING_NODE:
console.warn(
"The path to the Node binary could not be found. Please ensure that Node is properly "
"installed and added to your system's PATH environment variable or try running "
"`reflex init` again."
)
# Check for invalid command first.
if None in args:
console.error(f"Invalid command: {args}")
raise typer.Exit(1)
# Add the node bin path to the PATH environment variable.

path_env: str = os.environ.get("PATH", "")

# Add node_bin_path to the PATH environment variable.
if not environment.REFLEX_BACKEND_ONLY.get():
node_bin_path = str(path_ops.get_node_bin_path())
if not node_bin_path and not prerequisites.CURRENTLY_INSTALLING_NODE:
console.warn(
"The path to the Node binary could not be found. Please ensure that Node is properly "
"installed and added to your system's PATH environment variable or try running "
"`reflex init` again."
)
path_env = os.pathsep.join([node_bin_path, path_env])

env: dict[str, str] = {
**os.environ,
"PATH": os.pathsep.join(
[node_bin_path if node_bin_path else "", os.environ["PATH"]]
), # type: ignore
"PATH": path_env,
**kwargs.pop("env", {}),
}

kwargs = {
"env": env,
"stderr": None if show_logs else subprocess.STDOUT,
Expand Down

0 comments on commit 5d49167

Please sign in to comment.