Skip to content

@electron/rebuild ignores symlinks for native modules, which crashes the application #1123

Open
@beshkenadze

Description

Great! Including a demo project to reproduce the bug is an excellent way to provide additional context and aid in troubleshooting. Here's a revised version of your GitHub issue incorporating the link to your demo project:


Body:

Environment:

  • Electron Forge version: 7.2.0
  • Electron version: v28.2.0
  • Operating System and version: macOS Sonoma 14.2.1
  • Last known working Electron Forge version (if applicable): n/a

Issue Description:
When using electron-rebuild in my Electron Forge project, I've encountered a bug where the symlinks for native modules are ignored during the copy process. This leads to crashes, as the necessary libraries are not correctly linked.

Steps to Reproduce:

  1. Clone the demo project: https://github.com/beshkenadze/electron-forge-native_modules-symlink-bug
  2. npm i & npm run start

Expected Behavior:
The electron-rebuild process should handle symlinks in native_modules correctly, ensuring that all necessary libraries are properly linked and accessible.

Actual Behavior:
Symlinks in native_modules are ignored during the rebuild process, causing runtime crashes due to missing library links.

Additional Information:

App threw an error during load
Error: dlopen(/Users/.../my-new-app/.webpack/main/native_modules/lib/napi-v8/tfjs_binding.node, 0x0001): Library not loaded: @loader_path/../../deps/lib/libtensorflow.2.dylib
  Referenced from: <DE780050-AAAC-3B4D-955D-C8090D464B45> /Users/.../my-new-app/.webpack/main/native_modules/lib/napi-v8/tfjs_binding.node
  Reason: tried: '/Users/.../my-new-app/.webpack/main/native_modules/lib/napi-v8/../../deps/lib/libtensorflow.2.dylib' (no such file)

Screenshots/Logs:

Orignal libs

orignal_libs

Copied libs

copied_libs

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