Skip to content

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

@pandaymx

Description

@pandaymx

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions