如何从node.js应用程序制作exe文件? [英] How to make exe files from a node.js app?

查看:534
本文介绍了如何从node.js应用程序制作exe文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我编写的节点应用程序,我运行如下:

I have a node app that I wrote, that I run as follows:

node.exe app.js inputArg

我有什么方法可以将它自己打包成.exe吗?所以我可以做这样的事情?

Is there some way I can package this into a .exe by itself? So I can just do something like this?

App.exe inputArg

我有一些方法可以通过使用批处理文件来伪造这个,所以我可以这样做:

I have some way of faking this by using a batch file, so I can do this:

App.bat inputArg

但这需要我拥有该文件夹中的所有依赖项和节点,这是不理想的。

But this requires that I have all the dependencies and node in that folder, which is not ideal.

推荐答案

有一些选择,包括免费和商业。我没有使用它们,但理论上它们应该可以工作:

There a few alternatives, both free and commercial. I haven't used any of them but in theory they should work:

  • Iexpress (native windows tool)
  • Quick Batch File Compiler (commercial)
  • BoxedApp Packer
  • "Advanced" Batch To EXE Converter" (freeware)

大多数都要求您将批处理文件保存为主可执行文件,然后捆绑节点.exe和你的脚本。

Most will require you to keep the batch file as main executable, and then bundle node.exe and your scripts.

根据你的脚本,你也可以选择将它移植到 JSDB ,只需追加即可支持创建可执行文件的简便方法资源到它。

Depending on your script, you also have the option to port it to JSDB, which supports an easy way to create executables by simply appending resources to it.

第三个准解决方案是将节点保存在某个地方,如 C:\\\\\\\\\\\\将此文件夹添加到 PATH 环境变量中。然后你可以在那个运行节点+你喜欢的脚本的目录中创建.bat文件 - 我得到了coffeescript的咖啡以这种方式在windows上工作。可以使用批处理文件,vb脚本或安装程序自动完成此设置。

A third quasi-solution is to keep node somewhere like C:\utils and add this folder to your PATH environment variable. Then you can create .bat files in that dir that run node + your preferred scripts - I got coffeescript's coffee working on windows this way. This setup can be automated with a batch file, vb script or installer.

这篇关于如何从node.js应用程序制作exe文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆