Skip to content

Unable to Replace app.asar.unpacked at Runtime for Versions Above 25.0.0 #9049

Open
@yuanhongyu123

Description

@yuanhongyu123

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.

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