Hello team,
I'm writing to propose a small but impactful update to the Electron Forge documentation, specifically for users who prefer to use pnpm.
Currently, the official "Getting Started" guide suggests adding node-linker=hoisted to the .npmrc file to address installation issues with pnpm. While this is a great step, I've noticed that it doesn't fully resolve the problem for everyone. Users still frequently encounter the Error: Electron failed to install correctly message.
The root cause seems to be that pnpm's default behavior can prevent Electron's essential postinstall script (install.js) from running properly. After some investigation, I've found that adding an additional configuration to package.json can reliably fix this issue.
The Proposed Solution
I suggest we update the guide to recommend adding the onlyBuiltDependencies field for Electron within the pnpm configuration in package.json.
Here’s how the package.json file would look:
{
"name": "my-electron-app",
"version": "1.0.0",
"description": "A minimal Electron application",
// ...
"pnpm": {
"onlyBuiltDependencies": [
"electron"
]
}
}
This configuration explicitly tells pnpm to treat the electron package as a build dependency, ensuring its postinstall script executes as intended. By including this, we can prevent the installation error and provide a more seamless experience for all pnpm users.
Why this is a good idea
- Improved User Experience: This simple addition would save new users from getting stuck right at the beginning of their Electron development journey.
- Reduced Support Requests: Fewer users will need to open issues or seek help for this common installation problem.
- More Robust Documentation: Our official guide will become even more comprehensive and accurate.
I believe this small change would be a significant help to the community. Please let me know if you have any questions.
Thank you for your time and consideration!
Error message

After

Hello team,
I'm writing to propose a small but impactful update to the Electron Forge documentation, specifically for users who prefer to use pnpm.
Currently, the official "Getting Started" guide suggests adding
node-linker=hoistedto the.npmrcfile to address installation issues withpnpm. While this is a great step, I've noticed that it doesn't fully resolve the problem for everyone. Users still frequently encounter theError: Electron failed to install correctlymessage.The root cause seems to be that
pnpm's default behavior can prevent Electron's essentialpostinstallscript (install.js) from running properly. After some investigation, I've found that adding an additional configuration topackage.jsoncan reliably fix this issue.The Proposed Solution
I suggest we update the guide to recommend adding the onlyBuiltDependencies field for Electron within the pnpm configuration in
package.json.Here’s how the
package.jsonfile would look:{ "name": "my-electron-app", "version": "1.0.0", "description": "A minimal Electron application", // ... "pnpm": { "onlyBuiltDependencies": [ "electron" ] } }This configuration explicitly tells pnpm to treat the electron package as a build dependency, ensuring its postinstall script executes as intended. By including this, we can prevent the installation error and provide a more seamless experience for all pnpm users.
Why this is a good idea
I believe this small change would be a significant help to the community. Please let me know if you have any questions.
Thank you for your time and consideration!
Error message

After
