Fix Windows/VSCode Electron startup issues#47
Open
Jeffrey0117 wants to merge 1 commit intoyan5xu:mainfrom
Open
Fix Windows/VSCode Electron startup issues#47Jeffrey0117 wants to merge 1 commit intoyan5xu:mainfrom
Jeffrey0117 wants to merge 1 commit intoyan5xu:mainfrom
Conversation
## Problems Fixed:
1. **ELECTRON_RUN_AS_NODE environment variable conflict**
- When running from VSCode/Cursor (Electron-based IDEs), `ELECTRON_RUN_AS_NODE=1` is inherited
- This causes `require('electron')` to return a path string instead of the API object
- Added `start-electron.js` script that clears this env var before spawning Electron
2. **Electron initialization timing issues**
- `app.getPath()` was called before app ready in LogManager
- `ipcMain.handle` was called before app ready in IPCHandlers
- Moved these initializations to after `app.whenReady()`
3. **Windows Python virtual environment path**
- Added `.venv/Scripts/python.exe` path for Windows (was only checking `.venv/bin/python`)
## Files Changed:
- `start-electron.js` (new) - Electron launcher that clears problematic env vars
- `package.json` - Updated dev:main script to use new launcher
- `main.js` - Moved IPC and env var init to app.whenReady()
- `src/helpers/logManager.js` - Added lazy initialization for Electron APIs
- `src/helpers/funasrManager.js` - Added Windows venv path support
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problems Fixed:
ELECTRON_RUN_AS_NODE environment variable conflict
ELECTRON_RUN_AS_NODE=1is inheritedrequire('electron')to return a path string instead of the API objectstart-electron.jsscript that clears this env var before spawning ElectronElectron initialization timing issues
app.getPath()was called before app ready in LogManageripcMain.handlewas called before app ready in IPCHandlersapp.whenReady()Windows Python virtual environment path
.venv/Scripts/python.exepath for Windows (was only checking.venv/bin/python)Files Changed:
start-electron.js(new) - Electron launcher that clears problematic env varspackage.json- Updated dev:main script to use new launchermain.js- Moved IPC and env var init to app.whenReady()src/helpers/logManager.js- Added lazy initialization for Electron APIssrc/helpers/funasrManager.js- Added Windows venv path support