Use this guide to diagnose common runtime and packaged-app failures without changing public install, API, or UI behavior.
- Check whether the lightweight endpoint starts.
cd electron-app && npm run backend:live
- Run the backend diagnostic helper for port, process, and endpoint details.
python scripts/diagnose_backend.py
- Inspect Electron backend startup output.
- Main-process lifecycle code keeps a bounded backend-output tail for remediation messages.
- Startup orchestration lives in
electron-app/src/main/backend-lifecycle.js.
- For import failures, verify dependencies in the active venv.
python -m pytest backend/tests/test_lightweight_live.py
Standard native builds require the PyTorch MiDaS Torch Hub cache under models/torch-cache; ONNX files are optional for standard builds.
- Verify repo resources.
npm run verify:resources
- If the Torch cache is missing, rerun the platform setup step.
npm run setup:mac # or setup:linux / setup:win - Rebuild after setup so packaged resources include the refreshed cache.
npm run build:mac:arm64
ONNX builds and ONNX-only verification require all three files in models/onnx:
midas_small.onnxdpt_hybrid.onnxdpt_large.onnx
- For a standard build, missing ONNX files are not fatal.
- For an ONNX build, rerun ONNX setup for the target platform.
npm run setup:mac:onnx # or setup:linux:onnx / setup:win:onnx - Validate existing ONNX files only when they exist locally.
npm run verify:onnx
- Use
npm run verify:onnx:requiredto confirm all three ONNX files are present and non-empty without exporting new files.
DepthLens Pro probes backend ports before launching and records backend ownership metadata to avoid killing unrelated processes.
- Run the diagnostic helper.
python scripts/diagnose_backend.py
- Stop a DepthLens-owned backend process.
cd electron-app && npm run kill:backend
- If another process owns the port, stop that process manually or launch DepthLens on a free fallback port.
Packaged apps must contain the backend, frontend, Python runtime expectations, Torch cache, and optional/required ONNX files according to the build mode.
- Verify a packaged app after build.
cd electron-app && npm run verify:packaged
- For platform-specific checks, use the matching script.
cd electron-app && npm run verify:packaged:mac cd electron-app && npm run verify:packaged:win cd electron-app && npm run verify:packaged:linux
- If verification fails, rerun setup and rebuild rather than copying files into an installed app by hand.
Settings persistence is sanitized and backed up when corruption is detected.
- Settings schema and backup behavior live in
electron-app/src/main/settings-store.js. - Run the persistence schema test.
cd electron-app && node test-persistence-schema.js
- If a local settings file is corrupt, keep the generated backup for diagnosis and let the app recreate sanitized defaults.
- Do not relax Electron security defaults to work around settings issues; keep preload/contextBridge boundaries intact.