Skip to content

[Bug] Workspace dependencies (@memmy/backend, @memmy/local-api-contracts) not included in app.asar when building from source #89

Description

@Shackbear

Environment

  • macOS Apple Silicon (arm64)
  • Building from source (git clone + npm install + electron-builder)
  • Node.js v22.16.0, npm 10.8.2

Description

When building the desktop app from source using electron-builder, the workspace dependencies @memmy/backend, @memmy/local-api-contracts, and @memmy/desktop-interface are not included in the packaged app.asar. The app crashes on startup with:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Applications/Memmy.app/Contents/Resources/app.asar/node_modules/@memmy/backend/dist/src/index.js'

Root Cause

These packages are declared as workspace dependencies with version "0.0.0" in App/shell/desktop/package.json. npm resolves them via symlinks in the monorepo's node_modules, but electron-builder may not follow workspace symlinks when packaging the asar.

The package-mac-dmg.sh script handles this implicitly during its build flow, but building directly with electron-builder does not.

Workaround

Manually copy the workspace packages into App/shell/desktop/node_modules/@memmy/ before running electron-builder:

cp -R App/backend App/shell/desktop/node_modules/@memmy/backend
cp -R App/backend/local-api-contracts App/shell/desktop/node_modules/@memmy/local-api-contracts
cp -R App/shell/desktop/interface App/shell/desktop/node_modules/@memmy/desktop-interface

Suggested Fix

Either:

  1. Add a pre-pack script that copies workspace dependencies into the desktop's node_modules
  2. Or configure electron-builder's files pattern to explicitly include workspace package paths
  3. Or document that package-mac-dmg.sh must be used (not direct electron-builder) and add an environment check

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