独立的Node.js应用程序 [英] Standalone Node.js application

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

问题描述

我正在考虑开发一个由两部分组成的桌面应用程序:

I am considering developing a desktop application composed of 2 parts:

  • 用户界面(例如Java应用)
  • 后端Node.js服务器

2个部分通过插座连接.不要问为什么我知道这很奇怪.

The 2 parts connect through sockets. Don't ask why I know it's weird.

我将希望能够为客户提供带有安装程序的应用程序.我不希望用户必须自己安装Node.js.

I will want to be able to provide to customers the application with an installer. I don't want that users have to install Node.js themselves.

是否可以独立安装Node.js服务器,即无需在系统上全局安装Node.js.

Is there a way to have a Node.js server installed as standalone, i.e. no need to install Node.js globally on the system.

这是任何(Windows,Linux,Mac OS X ...)环境的问题.

推荐答案

您可以将二进制文件与应用程序捆绑在一起.无需安装任何程序即可运行Node应用程序.二进制文件与安装程序在同一页上的可用.

You can bundle the binaries with your application. Won't have to install anything to run a Node app. The binaries are available on the same page as the installers.

您只需要知道二进制文件在哪里,但我认为您已经有了一个安装程序,可以将该二进制文件放置在已知的位置.

You'll just have to know where the binaries are, but I assume you've got an installer that can put them somewhere known.

// To start the node process
$ /path/to/binaries/npm install
$ /path/to/binaries/node myApp.js

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

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