如何使用Node.js创建独立的命令行应用程序 [英] How to create a stand alone command line application with Node.js

查看:135
本文介绍了如何使用Node.js创建独立的命令行应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种方法来使用我在没有安装node.js的计算机上创建的命令行nodejs应用程序。换句话说,如何使用node.js在里面封装我的应用程序,以避免用户已经安装了node.js。

I'm trying to find a way to use a command line nodejs application that I created on a computer without node.js installed. In other words how to package my application with node.js inside, in order to avoid the users to have node.js already installed.

典型的用例是:I运行应用程序和应用程序使用与应用程序一起提供的节点核心(或应用程序检查是否安装了node.js,如果没有安装,则自动下载并安装它)。

The tipical use case is: I run the application and the application works using the node core that is provide with the application (or the application checks if there is node.js installed, and if not it download and install it automatically).

你有什么想法吗?

推荐答案

JXcore 允许你这样做。

一旦你在Windows或者UNIX系统上安装了JXcore必须做的是运行:

Once you have JXcore installed on windows (or unix systems), all you have to do is run:

jx package app.js "myAppName" -native

这将产生一个.exe(或unix可执行文件,如果该命令在unix系统上运行)外部依赖关系(你甚至不需要JXcore和Node.js在系统上)。

This will produce a .exe (or unix executable if the command was run on a unix system) file that you can distributed and can be executed without any external dependencies whatsoever (you don't even need JXcore nor Node.js on the system).

这里有关于该功能的文档: http://jxcore.com/packaging-code-protection/#cat-74

Here's the documentation on that functionality: http://jxcore.com/packaging-code-protection/#cat-74

(重复的 http://stackoverflow.com/a/27551233/810830

这篇关于如何使用Node.js创建独立的命令行应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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