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 Forge resolving path to node module using absolute path rather than using relative path in production #3691

Open
3 tasks done
ec2-learn-instant opened this issue Sep 11, 2024 · 6 comments
Labels
blocked/needs-repro Issues unable to be reproduced by maintainers

Comments

@ec2-learn-instant
Copy link

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.4.0

Electron version

30.5.0

Operating system

Windows 10

Last known working Electron Forge version

No response

Expected behavior

I'm trying to create an app that include the get-windows npm package, it's properly working in development mode. After I make production build, it throws error, reason beacuse its takes the development path in production build

Actual behavior

[error] (node:13140) UnhandledPromiseRejectionWarning: Error: D:\VMKV\electron-app\node_modules\get-windows\package.jsondoes not exist
at t.find (C:\Users\Quick App Studio\AppData\Local\Programs\my-electron-app\resources\app.asar.webpack\main\index.js:2:3391)
at p (C:\Users\Quick App Studio\AppData\Local\Programs\my-electron-app\resources\app.asar.webpack\main\index.js:2:1654721)
at m (C:\Users\Quick App Studio\AppData\Local\Programs\my-electron-app\resources\app.asar.webpack\main\index.js:2:1654862)
at Module.n (C:\Users\Quick App Studio\AppData\Local\Programs\my-electron-app\resources\app.asar.webpack\main\index.js:2:1649771)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async App. (C:\Users\Quick App Studio\AppData\Local\Programs\my-electron-app\resources\app.asar.webpack\main\index.js:2:13148557)

Steps to reproduce

Also note, I am using the following versions:

Node: 20.16.0
Electron: ^30.5.0
electron-forge/cli: ^7.4.0
get-windows: ^9.2.0

Please let me know if there's any missing info.

Additional information

No response

@rtritto
Copy link

rtritto commented Sep 11, 2024

#3209 probably related

@bearsworth
Copy link

I have this issue too. I am not sure why it takes the absolute path rather than the relative path. Same exact package too oddly enough. If anyone finds a work around, please leave it here!

@bukacdan
Copy link

bukacdan commented Dec 5, 2024

Same package, same issue, @electron-forge/cli": "^7.5.0

@erickzhao
Copy link
Member

Hey, I'm unable to reproduce this issue out of the box with a fresh installation of Forge + the get-windows directry.

Here's my repro code:

erickzhao/electron-forge-repros@56e5778

Here's a screenshot of it working for me:

Image

If someone could provide additional reproduction parameters, that'd be really helpful. Maybe it has to do with package managers as @rtritto mentioned? I'm currently using Yarn Classic.

@erickzhao erickzhao added the blocked/needs-repro Issues unable to be reproduced by maintainers label Jan 31, 2025
@bearsworth
Copy link

Hey, I'm unable to reproduce this issue out of the box with a fresh installation of Forge + the get-windows directry.

Here's my repro code:

erickzhao/electron-forge-repros@56e5778

Here's a screenshot of it working for me:

Image

If someone could provide additional reproduction parameters, that'd be really helpful. Maybe it has to do with package managers as @rtritto mentioned? I'm currently using Yarn Classic.

I think it’s because you have a different operating system from the issue. Try it on Windows.

@erickzhao
Copy link
Member

Hey @bearsworth, thanks for the response. My tester code also compiled for me on Windows 11 x64, with two caveats:

  • I think there was some ESM/CJS interop stuff that I was missing in the tester code that wasn't a problem in Node 22. The code doesn't work for Node 20 and under.
  • Reading the original issue more carefully, I see the error log seems to point to a .webpack folder. Are you also using the Webpack plugin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/needs-repro Issues unable to be reproduced by maintainers
Projects
None yet
Development

No branches or pull requests

5 participants