Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron can't find module if this module imported from npm workspaces #5713

Closed
cawa-93 opened this issue Mar 15, 2021 · 8 comments
Closed
Labels

Comments

@cawa-93
Copy link
Contributor

cawa-93 commented Mar 15, 2021

  • Version: 22.10.5
  • Electron Version: 12.0.1
  • Electron Type (current, beta, nightly):current
  • Target: Windows 10 x64

Description

Electron can't find module if this module imported from npm workspaces. I guess the reason is that there is no package-lock.json file in the packed application.

Repo with reproduction: https://github.com/cawa-93/electron-builder-issue.

Steps to reproduce

  1. Clone repo
  2. Install electron and electron-builder: npm ci
  3. Try run in Node:
    node /path/to/electron-builder-issue/packages/main/dist/index.cjs
    
    Expected output:
    /path/to/electron-builder-issue/packages/renderer/dist/index.html
    
  4. Build Electron app: npm run build
  5. Try run in Electron:
    /path/to/electron-builder-issue/dist/win-unpacked/vite-electron-builder.exe
    
    Expected output:
    /path/to/electron-builder-issue/dist/win-unpacked/resources/app/packages/renderer/dist/index.html
    
    Actual behaver:
    Electron throw Error: Can not find module "@packages/renderer"
  6. Try to fix
    1. Go to cd /path/to/electron-builder-issue/dist/win-unpacked/resources/app
    2. npm install
    3. Repeat Step 5.
@develar
Copy link
Member

develar commented Mar 15, 2021

I see your twit... Have you tried PNPM workspace instead of NPM ;)?

@cawa-93
Copy link
Contributor Author

cawa-93 commented Mar 15, 2021

@develar I can't do that. I'm working on a template, so I want to minimize count of non-native tools.

@develar
Copy link
Member

develar commented Mar 15, 2021

I think issue is that electron-builder somehow modifies package.json.

@stale
Copy link

stale bot commented Jun 4, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Jun 4, 2021
@cawa-93
Copy link
Contributor Author

cawa-93 commented Jun 4, 2021

Is this still relevant?

Yes

@stale stale bot removed the backlog label Jun 4, 2021
@stale
Copy link

stale bot commented Sep 19, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Sep 19, 2021
@cawa-93
Copy link
Contributor Author

cawa-93 commented Sep 20, 2021

Yes.
Tested on
Electron: v14, v15.0.0-beta.7
electron-builder: v22.11.11, v22.14.2

@stale stale bot removed the backlog label Sep 20, 2021
@stale
Copy link

stale bot commented Apr 17, 2022

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the backlog label Apr 17, 2022
@stale stale bot closed this as completed Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants