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

Volta Error: volta-shim Invoked Directly by Reflex on reflex run #4376

Closed
bilgilendir opened this issue Nov 13, 2024 · 7 comments · Fixed by #4664
Closed

Volta Error: volta-shim Invoked Directly by Reflex on reflex run #4376

bilgilendir opened this issue Nov 13, 2024 · 7 comments · Fixed by #4664
Labels
bug Something isn't working workaround available

Comments

@bilgilendir
Copy link

Describe the bug
When running reflex run, Reflex automatically attempts to use volta-shim to start the frontend, which results in an error. Volta's volta-shim should not be called directly, as Volta expects commands to be executed via the standard node or yarn commands instead. This prevents the frontend from starting successfully.

To Reproduce
Steps to reproduce the behavior:
Set up a new Reflex project on macOS with pipenv.
During reflex init, choose the blank template.
Run the command reflex run --loglevel debug

Expected behavior
Reflex should use Volta's node or yarn executables directly to start the frontend, avoiding volta-shim. The project should start without errors.

Specifics (please complete the following information):
Python Version: 3.9.6
Reflex Version: 0.6.5
OS: macOS 15.1

Additional context
pipenv Version: 2024.4.0
Volta Version: 2.0.1
Reflex is installed in a virtual environment via pipenv.
Reflex’s configuration appears to default to using volta-shim instead of node or yarn, causing the error below during reflex run --loglevel debug.

Log
────────────────────────────────────────────────────────────────────────────────────── System Info ───────────────────────────────────────────────────────────────────────────────────────
Debug: Config file: '/Users/username/.local/share/virtualenvs/proj-XXXXXX/lib/python3.9/site-packages/reflex/config.py'
Debug: Config: app_name='proj' loglevel=<LogLevel.DEFAULT: 'default'> frontend_port=3000 frontend_path='' backend_port=8000 api_url='http://localhost:8000'
deploy_url='http://localhost:3000' backend_host='0.0.0.0' db_url='sqlite:///reflex.db' redis_url=None telemetry_enabled=True bun_path=PosixPath('/Users/username/Library/Application
Support/reflex/bun/bin/bun') static_page_generation_timeout=60 cors_allowed_origins=['*'] tailwind={'plugins': ['@tailwindcss/typography']} timeout=120 next_compression=True
react_strict_mode=True frontend_packages=[] cp_backend_url='https://rxcp-prod-control-plane.fly.dev' cp_web_url='https://control-plane.reflex.run'
gunicorn_worker_class='uvicorn.workers.UvicornH11Worker' gunicorn_workers=None gunicorn_max_requests=100 gunicorn_max_requests_jitter=25 state_manager_mode=<StateManagerMode.DISK:
'disk'> redis_lock_expiration=10000 redis_token_expiration=3600 env_file=None
Debug: Running command: ['/Users/username/.volta/bin/node', '-v']
Debug: Running command: [PosixPath('/Users/username/Library/Application Support/reflex/fnm/fnm'), '--version']
Debug: Running command: ['/Users/username/Library/Application Support/reflex/bun/bin/bun', '-v']
Debug: [Reflex 0.6.5 with Python 3.9.6 (PATH: /Users/username/.local/share/virtualenvs/proj-XXXXXX/bin/python)]
Debug: [Node 22.11.0 (Expected: 22.11.0) (PATH:/Users/username/.volta/bin/node)]
Debug: [FNM None (Expected: 1.35.1) (PATH: /Users/username/Library/Application Support/reflex/fnm/fnm)]
Debug: [Bun 1.1.29 (Expected: 1.1.29) (PATH: /Users/username/Library/Application Support/reflex/bun/bin/bun)]
Debug: [OS Darwin Darwin Kernel Version 24.1.0: Thu Oct 10 21:02:45 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8112]
Debug: Using package installer at: /Users/username/Library/Application Support/reflex/bun/bin/bun
Debug: Using package executer at: /opt/homebrew/Cellar/volta/2.0.1/bin/volta-shim
Debug: Unzip path: /usr/bin/unzip
────────────────────────────────────────────────────────────────────────────────── Starting Reflex App ───────────────────────────────────────────────────────────────────────────────────
/Users/username/.local/share/virtualenvs/proj-XXXXXX/lib/python3.9/site-packages/urllib3/init.py:35: NotOpenSSLWarning:

urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: urllib3/urllib3#3020

[11:58:15] Compiling: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 13/13 0:00:00
Debug: Running command: ['/opt/homebrew/Cellar/volta/2.0.1/bin/volta-shim', 'run', 'next', 'telemetry', 'disable']
Debug: Running command: ['/Users/username/.volta/bin/node', '-v']
INFO: Will watch for changes in these directories: ['/Users/username/Desktop/proj/proj']
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: Started reloader process [10528] using StatReload
────────────────────────────────────────────────────────────────────────────────────── App Running ───────────────────────────────────────────────────────────────────────────────────────
Debug: Running command: ['/opt/homebrew/Cellar/volta/2.0.1/bin/volta-shim', 'run', 'dev']
Debug: Starting frontend
Debug: Volta error: 'volta-shim' should not be called directly.
Debug:
Debug: Please use the existing shims provided by Volta (node, yarn, etc.) to run tools.
Starting frontend failed with exit code 126
Volta error: 'volta-shim' should not be called directly.

Please use the existing shims provided by Volta (node, yarn, etc.) to run tools.
Run with --loglevel debug for the full log.
/Users/username/.local/share/virtualenvs/proj-XXXXXX/lib/python3.9/site-packages/urllib3/init.py:35: NotOpenSSLWarning:

urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: urllib3/urllib3#3020

INFO: Started server process [10579]
INFO: Waiting for application startup.
INFO: Application startup complete.

@bilgilendir bilgilendir added the bug Something isn't working label Nov 13, 2024
Copy link

linear bot commented Nov 13, 2024

@bilgilendir
Copy link
Author

The bug still exists

Reflex Version: 0.6.8
Python Version: 3.9.6
pipenv Version: 2024.4.0
Volta Version: 2.0.1

@bilgilendir bilgilendir mentioned this issue Jan 11, 2025
24 tasks
@iCarossio
Copy link

iCarossio commented Jan 18, 2025

Hey, I am stuck with the exact same issues on macOS.

Just tried to run

reflex init --template dashboard 
reflex run --loglevel debug
[truncated]
─────────────────────────────────────────────────────────────────────────────────────────────────────────────── App Running ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Debug: Running command: ['/opt/homebrew/Cellar/volta/2.0.2/bin/volta-shim', 'run', 'dev']
Debug: Starting frontend
Debug: Volta error: 'volta-shim' should not be called directly.
INFO:     Will watch for changes in these directories: ['/Users/acarossio/Work/product/reflex-test/reflex_test']
Debug: 
Debug: Please use the existing shims provided by Volta (node, yarn, etc.) to run tools.
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [233] using StatReload
Starting frontend failed with exit code 126
Volta error: 'volta-shim' should not be called directly.

Please use the existing shims provided by Volta (node, yarn, etc.) to run tools.
Run with --loglevel debug  for the full log.

Any clue?

Volta: 2.0.2
Python: 3.13.1
Reflex: 0.6.8

@adhami3310
Copy link
Member

What is the output of which npm, or in Python, shutil.which("npm")? I'm assuming it would be volta-shim, which would be a bit annoying.

@iCarossio
Copy link

iCarossio commented Jan 18, 2025

Thanks for trying to help! :) Actually, it's ~/.volta/bin/npm (both which npm and shutil. which(('npm'))

@iCarossio
Copy link

Got it, the problem comes from the function get_package_manager() where in our case (I don't know for other cases), we don't wanna resolve the path.

Change

    if npm_path is not None:
        return str(Path(npm_path).resolve())

to

    if npm_path is not None:
        return npm_path

@sangmandu
Copy link

the code @iCarossio said is here

/venv/lib/python3.10/site-packages/reflex/utils/prerequisites.py:231:def get_package_manager(on_failure_return_none: bool = False) -> str | None:

and it worked out for me. thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workaround available
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants