electron-forge-docs icon indicating copy to clipboard operation
electron-forge-docs copied to clipboard

Electron Forge + Vite + Vue + TypeScript Integration Issue (pnpm)

Open pandaymx opened this issue 10 months ago • 5 comments

Description:

When attempting to integrate Vue 3 into an Electron Forge project created with Vite and TypeScript, using pnpm as the package manager and with the npm configuration node-linker=hoisted set, the application fails to start and throws an error related to Electron installation. This issue appears to be specifically triggered by the combination of these technologies and configurations.

Environment Information

  • Operating System: Windows 11
  • Node.js Version: v22.14.0
  • npm Version: 10.9.2
  • pnpm Version: 10.4.1
  • Electron Forge Version: ^7.7.0
  • Vite Version: ^5.4.14
  • Vue Version: ^3.5.13
  • TypeScript Version: ~4.5.4

Reproduction Steps

  1. Create Electron Forge project:

    npx create-electron-app@latest my-vue-app --template=vite+typescript
    
  2. Navigate to the project directory:

    cd my-vue-app
    
  3. Set npm configuration node-linker=hoisted:

  4. Integrate Vue 3:

  5. Run the application:

    pnpm run start  # Or the command you used to start the application
    

Error Message

An unhandled rejection has occurred inside Forge:
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at getElectronPath (F:\code\person\bill\node_modules\electron\index.js:17:11)
    at Object.<anonymous> (F:\code\person\bill\node_modules\electron\index.js:21:18)
    at Module._compile (node:internal/modules/cjs/loader:1554:14)
    at node:internal/modules/cjs/loader:1706:10
    at Object.require.extensions.<computed> [as .js] (F:\code\person\bill\node_modules\ts-node\src\index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:1289:32)
    at Function._load (node:internal/modules/cjs/loader:1108:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:220:24)
    at Module.require (node:internal/modules/cjs/loader:1311:12)
    at require (node:internal/modules/helpers:136:16)
    at locateElectronExecutable (F:\code\person\bill\node_modules\@electron-forge\core\src\util\electron-executable.ts:12:26)
    at async forgeSpawn (F:\code\person\bill\node_modules\@electron-forge\core\src\api\start.ts:166:28)
    at async forgeSpawnWrapper (F:\code\person\bill\node_modules\@electron-forge\core\src\api\start.ts:209:23)
    at async F:\code\person\bill\node_modules\@electron-forge\core\src\api\start.ts:244:21
    at async F:\code\person\bill\node_modules\@electron-forge\tracer\src\index.ts:51:14

pandaymx avatar Feb 23 '25 17:02 pandaymx

Can I take up this issue?

satyyam11 avatar Mar 08 '25 22:03 satyyam11

#223

Hey, I'm trying to work on this issue

Sanjai-Shaarugesh avatar Mar 23 '25 12:03 Sanjai-Shaarugesh

This issue is not fixed as of today ..

I tried it on windows, and it still fails, even though I did nothing more than running the first 3 steps, and run

pnpm start.

I also tried to do it with npm run start (after removing node modules and running npm install), I get the same error message.

edouard-mangel avatar May 22 '25 13:05 edouard-mangel

use electron vite bro...

Sanjai-Shaarugesh avatar May 22 '25 13:05 Sanjai-Shaarugesh

Also have this problem for React

garrettlove8 avatar May 25 '25 00:05 garrettlove8