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:
- Add a pre-pack script that copies workspace dependencies into the desktop's
node_modules
- Or configure electron-builder's
files pattern to explicitly include workspace package paths
- Or document that
package-mac-dmg.sh must be used (not direct electron-builder) and add an environment check
Environment
Description
When building the desktop app from source using
electron-builder, the workspace dependencies@memmy/backend,@memmy/local-api-contracts, and@memmy/desktop-interfaceare not included in the packagedapp.asar. The app crashes on startup with:Root Cause
These packages are declared as workspace dependencies with version
"0.0.0"inApp/shell/desktop/package.json. npm resolves them via symlinks in the monorepo'snode_modules, but electron-builder may not follow workspace symlinks when packaging the asar.The
package-mac-dmg.shscript handles this implicitly during its build flow, but building directly withelectron-builderdoes not.Workaround
Manually copy the workspace packages into
App/shell/desktop/node_modules/@memmy/before running electron-builder:Suggested Fix
Either:
node_modulesfilespattern to explicitly include workspace package pathspackage-mac-dmg.shmust be used (not directelectron-builder) and add an environment check