-
-
Notifications
You must be signed in to change notification settings - Fork 171
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 #189
Comments
This seems like an |
@Nantris - I ran into this issue as well, I'm pretty sure its caused by this code in
|
Interesting! Link to the relevant code for convenience: Lines 6 to 9 in 6e84e52
|
@Nantris - just for more context, I ran into this issue because the version of my Electron app packaged from GH Actions was complaining about a missing file in |
@sindresorhus - any thoughts on this? |
@sindresorhus - How to solve this? |
Hi @sindresorhus, after too many hours of spending my time, finally I solved this issue by using the process.resourcePath . Here is my code for production as well as development for Electron Forge Webpack - windows.js file
@Nantris @trinhxyz @jyboudreau Please take a look. |
@ec2-learn-instant - this looks like an okay work around, but IMO this shouldn't be needed and the package should just work out of the box |
For what it's worth, we do not use Still, if this can be resolved for |
Please open an issue on electron-forge instead. The problem is not with this package. |
I'm trying to create an app that include the get-windows npm package, but I cannot distribute my app because Electron Forge is using resolving the package to an absolute path rather than a relative path, so the app fails to find the package.
[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)
Also note, I am using the following versions:
Node: 20.16.0
Electron: ^30.0.2
electron-forge/cli: ^7.4.0
get-windows: ^9.2.0
Please let me know if there's any missing info.
The text was updated successfully, but these errors were encountered: