Giter Site home page Giter Site logo

not working with Electron-packager about gkm HOT 5 CLOSED

tomzx avatar tomzx commented on July 25, 2024
not working with Electron-packager

from gkm.

Comments (5)

tomzx avatar tomzx commented on July 25, 2024 1

It's been quite a while since I packaged any electron application, but back then I relied on https://github.com/electron-userland/electron-packager. Given their documentation (https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#asar), if you aren't packaging the source code into an asar archive, you should have nothing to do.

I'd suggest you first package your application, then install it, then go to the directory where it was installed and check whether you can find a node_modules directory inside. If you can, then check if you can find gkm directory within it. If you can, then things should work the same as if you were in your development environment. Also make sure that you can find the gkm.jar and JNativeHook.jar files.

On the other hand, if you can't find the node_modules nor the gkm directories, then it's likely that your source code is archived in an asar file. If you're using electron-packager, you can either disable using asar or only unpack a certain part of it (I never did myself). See the documentation I pointed at to know how to do that.

I'm not knowledgeable enough to know what are the downsides to unpacking, other than it exposes your source code on the file system.

from gkm.

tomzx avatar tomzx commented on July 25, 2024

Hello,

This is unlikely to be related to gkm itself. I'm going to guess that when your electron application is packaged, the node modules are packaged within an asar file (https://electronjs.org/docs/tutorial/application-packaging) and as such, when

gkm/gkm.js

Line 10 in b2d7bc9

var gkm = spawn('java', ['-jar', path.join(__dirname, 'lib/gkm.jar')]);

is called from gkm.js, java cannot find the jar file since it's not in the user file system but within that asar archive. I believe it should be possible for you to unpack the asar when installing the packaged application, which should solve this issue.

from gkm.

aizaku avatar aizaku commented on July 25, 2024

Hi,
Thank you for answering. Would you be so kind and guide me through that process?
Should I unpack the whole thing or just the gkm.js? Should I somehow point to it after unpacking? etc.

And are there any downsides to doing so?

from gkm.

aizaku avatar aizaku commented on July 25, 2024

Yes. That helped a lot. I was able to unpack it successfully using asar.unpackDir and unpacking node_modules. Unpacking just the gkm resulted in error since it wasn't able to locate eventemitter2 module. I did not try to unpack just those two, will maybe experiment a bit more, but quite happy with the result already.
Thank you.

from gkm.

tomzx avatar tomzx commented on July 25, 2024

Happy to see it worked out for you!

from gkm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.