nodejs-whisper icon indicating copy to clipboard operation
nodejs-whisper copied to clipboard

fix: WHISPER_CPP_MAIN_PATH constant in win32 platform & define execPath when using electron

Open moraxh opened this issue 9 months ago • 3 comments

This pull request introduces several modifications to the nodejs-whisper project to configure the shelljs library to utilize the Node.js executable path. The key changes include updates across multiple files to set shell.config.execPath to the Node.js executable path.

Configuration of shelljs:

  • src/autoDownloadModel.ts: Added configuration to set shell.config.execPath to the Node.js executable path.
  • src/downloadModel.ts: Added configuration to set shell.config.execPath to the Node.js executable path.
  • src/utils.ts: Added configuration to set shell.config.execPath to the Node.js executable path.
  • src/whisper.ts: Added configuration to set shell.config.execPath to the Node.js executable path.

Update to the WHISPER_CPP_MAIN_PATH constant:

  • src/constants.ts: Updated the WHISPER_CPP_MAIN_PATH for the Windows platform by removing the Release directory from the path.

Additional Reference:

For more information on shelljs compatibility with Electron and configuring the execPath, please refer to the ShellJS Electron compatibility wiki

moraxh avatar Mar 13 '25 17:03 moraxh

+1 Needed this for electron

Also needed a fix for models directory, which you can see at my fork:

https://github.com/nickdebaise/nodejs-whisper.git

nickdebaise avatar Mar 29 '25 00:03 nickdebaise

Thanks @moraxh! the Electron shelljs configuration is great and needed. however, the Windows path change conflicts with our recent CMake improvements.

could you please keep the shell.config.execPath changes

and revert the WHISPER_CPP_MAIN_PATH change

ChetanXpro avatar May 25 '25 07:05 ChetanXpro

Thanks @nickdebaise that path resolution fix look useful for Electron/webpack scenarios. I'll create a separate PR to address this properly.

ChetanXpro avatar May 25 '25 07:05 ChetanXpro