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

packaged app is unable to locate .node file in electron-forge #1245

Closed
robosushie opened this issue May 31, 2021 · 6 comments
Closed

packaged app is unable to locate .node file in electron-forge #1245

robosushie opened this issue May 31, 2021 · 6 comments
Labels
bug 🐛 needs info Issue reporter needs to provide more information for maintainers to take action

Comments

@robosushie
Copy link

I have built an application using electron-forge where I have added native Cpp functionality. The front end part is using react and I am using a webpack script that continuously watches for the changes in the react files

"watch": "webpack --config webpack.renderer.js --watch",

and generate a compiled version of the react files into a compiled_renderer.js. I am then adding directly to the HTML file as a script.

<script src="./compiled/compiled_renderer.js"></script>

I am using electron forge to build and package my project. Initally I was trying to package using asar = true, so that I can hide my code files while transferring the packaged folders to other systems, but the app was not running as the native node addons were getting compiled to a temp folder in windows and the packaged app was trying to reference that location. After a lot of searching and trial testing I tried this modification Link in my packager configs

"forge": {
"packagerConfig": {
"asar": {
"unpack": "*.{node,dll}"
}
},

and I am using bindings to import the node addon to my app.

const addon = require('bindings')('libsdr');

On I have packaged the app using the script

"package": "electron-forge package"

The node is correctly placed in the asar.unpacked folder, and is working correctly in my laptop but when I transferred the entire output folder to another laptop. It is still showing the error.

image

Whereas the file location for the node file is the same which it is trying to reference as shown in the error message.

image

But when I built the installer using "electron-forge make" and tried to install it on another laptop. After installation, it was again trying to reference the temp folder for the .node file.
Please can anyone help me with this issue? Thanks

@welcome
Copy link

welcome bot commented May 31, 2021

👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@malept
Copy link
Member

malept commented Jun 9, 2021

In order to debug your problem further, we need a minimal testcase to reproduce your problem. Using the electron-quick-start repository as a base, could you please create a minimal Electron app that illustrates the issue you described, and post a link to it here?

@malept malept added the needs info Issue reporter needs to provide more information for maintainers to take action label Jun 9, 2021
@no-response
Copy link

no-response bot commented Jun 16, 2021

Since the original issue reporter has not responded to the request for additional information in about a week, it's assumed that they either found the answer in another manner or decided not to pursue this issue. If this is incorrect, they can respond with answers to the questions posed, and this issue can be reopened.

@no-response no-response bot closed this as completed Jun 16, 2021
@gaoxianglyx
Copy link

same error, any solutions?

@jparismorgan
Copy link

I believe I'm also running into this and have created a simple test repo here: https://github.com/jparismorgan/electron-forge-napi-pnpm

@LZQCN
Copy link

LZQCN commented Nov 14, 2023

The reason for this error may be the .node file cannot find the .dll file in the same directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 needs info Issue reporter needs to provide more information for maintainers to take action
Projects
None yet
Development

No branches or pull requests

5 participants