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

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

node.exe app.js inputArg

节点。exe app.js inputArg

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

有什么办法可以把它单独打包成。exe文件吗?我可以这样做吗?

App.exe inputArg

App.exe inputArg

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

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

App.bat inputArg

App.bat inputArg

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

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

17 个解决方案

#1


24

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)
  • Iexpress(本机windows工具)
  • Quick Batch File Compiler (commercial)
  • 快速批处理文件编译器(商业)
  • "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.

大多数将要求您将批处理文件作为主要可执行文件,然后打包节点。exe和脚本。

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.

根据脚本的不同,您还可以选择将它移植到JSDB, JSDB支持一种简单的方法来创建可执行文件,只需向其添加资源。

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.

第三种准解决方案是将节点保存在C:\utils中,并将此文件夹添加到路径环境变量中。然后你可以在那个目录中创建.bat文件,运行node +你喜欢的脚本——我有coffeescript在windows上用这种方式工作。此设置可以通过批处理文件、vb脚本或安装程序自动完成。

更多相关文章

  1. 如何让Require.js获取一个不以`.js`结尾的脚本? [重复]
  2. 使用没有后端脚本的Angularjs上传文件(例如PHP,JAVA等)
  3. 浏览器环境下JavaScript脚本加载与执行探析之动态脚本与Ajax脚本
  4. 像C#一样,去写Javascript----记我的脚本库RockSniper.Scripts.js
  5. js的html元素的父节点,子节点
  6. 不使用chokidar更新所需的节点/快速模块?
  7. 当尝试安装节点时,会得到一个“DLL”错误。js在Windows 7上
  8. contains和compareDocumentPosition 方法来确定是否HTML节点间的
  9. 如何访问远程节点。浏览器中的js应用程序,而不是本地主机

随机推荐

  1. 编程语言之问:何时该借用,何时该创造?
  2. 用python分析1225万条淘宝数据,终于搞清楚
  3. GIL 已经被杀死了么?
  4. AQS之ReentrantReadWriteLock精讲分析上
  5. UNIX系列之AIX克隆系统盘
  6. 用鸿蒙开发AI应用(六)UI篇
  7. 用《矛盾论》来解读 Python
  8. 对比 C++ 和 Python,谈谈指针与引用
  9. PXE+kickstart无人值守装机
  10. 超全的pandas数据分析常用函数总结:下篇