René's URL Explorer Experiment


Title: electron-packager fails in npm workspaces monorepo · Issue #127 · kinectron/kinectron · GitHub

Open Graph Title: electron-packager fails in npm workspaces monorepo · Issue #127 · kinectron/kinectron

X Title: electron-packager fails in npm workspaces monorepo · Issue #127 · kinectron/kinectron

Description: Issue: electron-packager fails in npm workspaces monorepo Problem The npm run package script in the app/ workspace fails to run correctly when executed from either: The monorepo root: npm run package --workspace=app Inside the app direct...

Open Graph Description: Issue: electron-packager fails in npm workspaces monorepo Problem The npm run package script in the app/ workspace fails to run correctly when executed from either: The monorepo root: npm run packa...

X Description: Issue: electron-packager fails in npm workspaces monorepo Problem The npm run package script in the app/ workspace fails to run correctly when executed from either: The monorepo root: npm run packa...

Opengraph URL: https://github.com/kinectron/kinectron/issues/127

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"electron-packager fails in npm workspaces monorepo","articleBody":"# Issue: electron-packager fails in npm workspaces monorepo\n\n## Problem\n\nThe `npm run package` script in the `app/` workspace fails to run correctly when executed from either:\n- The monorepo root: `npm run package --workspace=app`\n- Inside the app directory: `cd app \u0026\u0026 npm run package`\n\nThe packaging process with `electron-packager` does not work properly in the npm workspaces environment.\n\n## Current Workaround\n\nTo successfully package the application:\n\n1. Copy the entire `app/` folder outside of the monorepo root\n2. Navigate into the copied folder\n3. Run `npm install` (this creates a local `node_modules/` in the copied folder)\n4. Run `npm run package`\n5. This successfully creates the packaged application\n\n## Technical Details\n\n### Root Cause\n\nThe issue stems from how npm workspaces manages dependencies:\n\n1. **Hoisted Dependencies**: In npm workspaces, dependencies are hoisted to the root `node_modules/` directory\n2. **No Local node_modules**: The `app/` workspace folder does not contain its own `node_modules/` directory\n3. **electron-packager Expectations**: `electron-packager` appears to search for dependencies using relative paths from the package being built\n4. **Path Resolution Failure**: When running in a workspace, `electron-packager` cannot find dependencies because they're at `../../node_modules/` instead of `./node_modules/`\n\n### Current Package Script\n\n```json\n{\n  \"scripts\": {\n    \"package\": \"npm run clean \u0026\u0026 electron-packager . --overwrite\"\n  }\n}\n```\n\n### Workspace Structure\n\n```\nkinectron-monorepo/\n├── node_modules/          ← All dependencies hoisted here\n├── package.json           ← Workspace root\n├── app/\n│   ├── package.json\n│   └── (no node_modules)  ← This is the problem\n├── client/\n└── examples/\n```\n\n### What Works\n\nWhen `app/` is copied outside the monorepo:\n- `npm install` creates a local `node_modules/` in the app folder\n- `electron-packager` finds all dependencies in the expected location\n- Packaging completes successfully\n\n## Possible Solutions\n\n### Option 1: Configure electron-packager for Workspaces (Quick Fix)\n\nAdd explicit configuration to handle workspace structure:\n\n```json\n{\n  \"scripts\": {\n    \"package\": \"npm run clean \u0026\u0026 electron-packager . --overwrite --no-prune --ignore='^/(?!app)'\"\n  }\n}\n```\n\nConsiderations:\n- `--no-prune` may include unnecessary files\n- May need to explicitly set `--ignore` patterns\n- Not guaranteed to work with hoisted dependencies\n\n### Option 2: Use Electron Forge (Recommended)\n\nMigrate from `electron-packager` to Electron Forge, which has better monorepo support:\n\n1. Install Electron Forge: `npm install --save-dev @electron-forge/cli`\n2. Initialize: `npx electron-forge import`\n3. Configure `forge.config.js` to work with workspace structure\n4. Update package script: `\"package\": \"electron-forge package\"`\n\nBenefits:\n- Better maintained and modern\n- Built-in support for monorepos\n- More configuration options\n- Better documentation\n\n### Option 3: Custom Packaging Script\n\nCreate a Node.js script that handles workspace-specific packaging:\n\n```javascript\n// scripts/package-app.js\nimport packager from 'electron-packager';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst rootDir = path.resolve(__dirname, '..');\n\npackager({\n  dir: path.join(rootDir, 'app'),\n  out: path.join(rootDir, 'dist'),\n  overwrite: true,\n  // Explicitly point to root node_modules\n  electronVersion: require('electron/package.json').version,\n  // ... other options\n});\n```\n\nThen update package.json:\n```json\n{\n  \"scripts\": {\n    \"package\": \"node scripts/package-app.js\"\n  }\n}\n```\n\n### Option 4: Use electron-builder Instead\n\nReplace `electron-packager` with `electron-builder`:\n\n1. Install: `npm install --save-dev electron-builder`\n2. Add build configuration to `app/package.json`\n3. Update script: `\"package\": \"electron-builder\"`\n\n`electron-builder` has better support for complex project structures.\n\n## Recommendation\n\n**Best long-term solution**: Migrate to **Electron Forge** (Option 2)\n- Industry standard\n- Active maintenance\n- Built for modern projects\n- Good monorepo support\n- Easier auto-updates\n\n**Quick fix**: Try **Option 1** with `--no-prune` and explicit node_modules paths\n\n## Related Files\n\n- [app/package.json](app/package.json:11) - Current package script\n- [package.json](package.json) - Workspace configuration\n\n## Environment\n\n- OS: Windows (MSYS_NT-10.0-26100)\n- Node.js: (current version)\n- npm workspaces: enabled\n- electron-packager: ^17.1.2\n","author":{"url":"https://github.com/lisajamhoury","@type":"Person","name":"lisajamhoury"},"datePublished":"2025-10-09T20:51:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/127/kinectron/issues/127"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:289102f8-dbc9-e075-29ec-cbeb1d9a3ae3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id963C:4DC05:814B4E7:AD099DD:698BBCC2
html-safe-nonceac57a0d2c7a9f7ce99025fd9bfe62485d1e3ec8b764ab3796190554108900531
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjNDOjREQzA1OjgxNEI0RTc6QUQwOTlERDo2OThCQkNDMiIsInZpc2l0b3JfaWQiOiI0MDA3MDQ0NTU3MjQxNTY0MzU0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacaa41560fed2a32032947b6da69719911817ee2eeec7318f8a1f12e474f43afcf
hovercard-subject-tagissue:3500592575
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/kinectron/kinectron/127/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ac2e6b89bebb43b7327601ca75e376d520bd1da1d3d4dd9aca863ab5cb284336/kinectron/kinectron/issues/127
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ac2e6b89bebb43b7327601ca75e376d520bd1da1d3d4dd9aca863ab5cb284336/kinectron/kinectron/issues/127
og:image:altIssue: electron-packager fails in npm workspaces monorepo Problem The npm run package script in the app/ workspace fails to run correctly when executed from either: The monorepo root: npm run packa...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamelisajamhoury
hostnamegithub.com
expected-hostnamegithub.com
None640eeb7b6ff4d8d106235d228c0c286e82592d4d2403227b5b2b4fc5832297a4
turbo-cache-controlno-preview
go-importgithub.com/kinectron/kinectron git https://github.com/kinectron/kinectron.git
octolytics-dimension-user_id35077404
octolytics-dimension-user_loginkinectron
octolytics-dimension-repository_id67945757
octolytics-dimension-repository_nwokinectron/kinectron
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id67945757
octolytics-dimension-repository_network_root_nwokinectron/kinectron
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3d444f0a47beeeac94cddbb51c91ab408befe8d4
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/kinectron/kinectron/issues/127#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fkinectron%2Fkinectron%2Fissues%2F127
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fkinectron%2Fkinectron%2Fissues%2F127
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=kinectron%2Fkinectron
Reloadhttps://patch-diff.githubusercontent.com/kinectron/kinectron/issues/127
Reloadhttps://patch-diff.githubusercontent.com/kinectron/kinectron/issues/127
Reloadhttps://patch-diff.githubusercontent.com/kinectron/kinectron/issues/127
kinectron https://patch-diff.githubusercontent.com/kinectron
kinectronhttps://patch-diff.githubusercontent.com/kinectron/kinectron
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fkinectron%2Fkinectron
Fork 45 https://patch-diff.githubusercontent.com/login?return_to=%2Fkinectron%2Fkinectron
Star 331 https://patch-diff.githubusercontent.com/login?return_to=%2Fkinectron%2Fkinectron
Code https://patch-diff.githubusercontent.com/kinectron/kinectron
Issues 3 https://patch-diff.githubusercontent.com/kinectron/kinectron/issues
Pull requests 0 https://patch-diff.githubusercontent.com/kinectron/kinectron/pulls
Actions https://patch-diff.githubusercontent.com/kinectron/kinectron/actions
Wiki https://patch-diff.githubusercontent.com/kinectron/kinectron/wiki
Security 0 https://patch-diff.githubusercontent.com/kinectron/kinectron/security
Insights https://patch-diff.githubusercontent.com/kinectron/kinectron/pulse
Code https://patch-diff.githubusercontent.com/kinectron/kinectron
Issues https://patch-diff.githubusercontent.com/kinectron/kinectron/issues
Pull requests https://patch-diff.githubusercontent.com/kinectron/kinectron/pulls
Actions https://patch-diff.githubusercontent.com/kinectron/kinectron/actions
Wiki https://patch-diff.githubusercontent.com/kinectron/kinectron/wiki
Security https://patch-diff.githubusercontent.com/kinectron/kinectron/security
Insights https://patch-diff.githubusercontent.com/kinectron/kinectron/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/kinectron/kinectron/issues/127
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/kinectron/kinectron/issues/127
electron-packager fails in npm workspaces monorepohttps://patch-diff.githubusercontent.com/kinectron/kinectron/issues/127#top
bughttps://github.com/kinectron/kinectron/issues?q=state%3Aopen%20label%3A%22bug%22
packaginghttps://github.com/kinectron/kinectron/issues?q=state%3Aopen%20label%3A%22packaging%22
https://github.com/lisajamhoury
https://github.com/lisajamhoury
lisajamhouryhttps://github.com/lisajamhoury
on Oct 9, 2025https://github.com/kinectron/kinectron/issues/127#issue-3500592575
app/package.jsonhttps://patch-diff.githubusercontent.com/kinectron/kinectron/issues/app/package.json:11
package.jsonhttps://patch-diff.githubusercontent.com/kinectron/kinectron/issues/package.json
bughttps://github.com/kinectron/kinectron/issues?q=state%3Aopen%20label%3A%22bug%22
packaginghttps://github.com/kinectron/kinectron/issues?q=state%3Aopen%20label%3A%22packaging%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.