Description
Description
I'm facing some issues with the hot - update feature in my Electron project after upgrading the Node.js and electron - builder versions. Here is a detailed description of the situation:
Previous Setup
Previously, my project used Node.js 18 and electron - builder@24.9.1. I used to replace the asar and app.asar.unpacked files for hot - updates, and this method worked flawlessly.
Upgrade Process and Issues Encountered
Upgrade to Node.js 20:
When I upgraded to Node.js 20, I encountered errors when rebuilding native dependencies such as SQLite during the packaging process.
Attempt to Upgrade electron - builder:
Version 25 and 26:
I tried upgrading electron - builder to versions 25 and 26. Only version 25 allowed me to package the application. However, when I ran the application to test the hot - update feature, I found that the app.asar.unpacked directory lacked write permissions and could not be replaced.
Native Modules in app.asar.unpacked:
I noticed that native modules like sqlite.node were automatically extracted to the app.asar.unpacked directory. I initially thought that sqlite.node was causing the problem. So, I adjusted electron - builder to versions between v25.0.0 and v25.0.3. In these versions, sqlite.node was not externalized, and the app.asar.unpacked directory only contained resource files. But still, when attempting a hot - update, I received an error indicating that app.asar.unpacked had no write permissions and could not be replaced.
Version 26 Packaging Issue:
When using electron - builder@26, after packaging, the application failed to run because the dependencies under dependencies were not packaged correctly.
Current Situation
electron - builder@24: The app.asar.unpacked directory has write permissions, but I cannot package my native modules due to errors.
electron - builder@25: The app.asar.unpacked directory does not have write permissions.
electron - builder@26: After packaging, the application cannot run because the dependencies are not included in the package.
Request
I'm seeking help on how to resolve these issues and make the hot - update feature work properly again. Any suggestions or solutions would be greatly appreciated.