windows 将 Node.js-Scripts + node.exe 打包成一个可执行文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7557364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:09:55  来源:igfitidea点击:

Packing Node.js-Scripts + node.exe into a single Executable

windowsnode.jsexe

提问by schokocappucino

Because Node.js now also available on Windows, I would like to share my scripts without including node.exe. Is it possible to pack the script (no more files) together with the node.exe into a single executable file?

因为 Node.js 现在也可以在 Windows 上使用,所以我想分享我的脚本而不包括 node.exe。是否可以将脚本(不再有文件)与 node.exe 打包成一个可执行文件?

采纳答案by Nepoxx

You absolutely can, and it's pretty easy with JXcore.

你绝对可以,而且使用JXcore很容易。

Once you have JXcore installed on windows, all you have to do is run:

在 Windows 上安装 JXcore 后,您所要做的就是运行:

jx package app.js "myAppName" -native

This will produce a .exe file that you can distribute and can be executed without any external dependencies whatsoever (you don't even need JXcore nor Node.js on the system).

这将生成一个 .exe 文件,您可以分发该文件并且可以在没有任何外部依赖的情况下执行该文件(您甚至不需要系统上的 JXcore 或 Node.js)。

Here's the documentation on that functionality: https://github.com/jxcore/jxcore/blob/master/doc/api/jxcore-feature-packaging-code-protection.markdown

这是关于该功能的文档:https: //github.com/jxcore/jxcore/blob/master/doc/api/jxcore-feature-packaging-code-protection.markdown

(Duplicate of https://stackoverflow.com/a/27551233/810830)

https://stackoverflow.com/a/27551233/810830 的副本)

回答by Christian Ivicevic

Have you tried WinRAR? It should give you the opportunity to create a self-extractable executable which unpacks all files to the TEMP folder. After doing this you can setup to run one exe file in the archive. Furthermore you can hide the "Unpack" dialog.

你试过 WinRAR 吗?它应该让您有机会创建一个自解压可执行文件,将所有文件解压到 TEMP 文件夹。完成此操作后,您可以设置在存档中运行一个 exe 文件。此外,您可以隐藏“解包”对话框。

回答by haohello

actually I think you can use adobe air to accomplish this, no need to include node.exe

实际上我认为您可以使用adobe air来完成此操作,无需包含node.exe

have you ever tried to develop hybrid applications with QtWebKit, which I think might be a very good direction for you., hope this helps.

你有没有尝试过用 QtWebKit 开发混合应用程序,我认为这对你来说可能是一个非常好的方向。希望这有帮助。