问题
I'm a Node.JS beginner, so please forgive me if my question is too naive or too simple:) I made myself a simple node.js app: index.js which requires my_module.js. The second one just displays console.log("Hello").
Now I would like to pack it somehow into single exe file (I work on Windows) to be able to run it on another machine without the need of having node installed. Is that even possible?
回答1:
The core problem was already answered from here I will provide some specifics on Windows in addition to answer.
basically;
- Download and Install JXcore
- Go to your apps folder
- Run 'jx package index.js myapp -native'
Be careful with the executable you have. If you are on 64 bit Windows, you will end up having a 64 bit executable of your application. Perhaps almost all the Windows installations nowadays are 64 bits and this won't be a big deal. However you can also have a 32 bit version by re-packaging the app on 32 bit Windows. AFAIK the upcoming update to JXcore will be handling this confusion.
回答2:
I wrote a blog post on this here:
http://www.alexjamesbrown.com/blog/development/create-a-standalone-exe-to-run-a-node-js-application/
来源:https://stackoverflow.com/questions/29604839/can-i-make-node-js-app-self-executable