Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EncloseJS vs Nexe [closed]

Tags:

node.js

Does anyone have experience compiling node.js applications into distributable binaries? The two options I'm seeing are encloseJS and nexe, but don't really see major differences besides faster compile times with encloseJS.

like image 272
user3379893 Avatar asked Jul 02 '15 15:07

user3379893


1 Answers

I've been using JXcore - https://github.com/jxcore/jxcore It has a lot of features apart from the compilation, including multithreading and restart management. But it does seem to be stuck back at Node 0.10. Now that Node 4 is out, and the Long Term Support arrangement is in place, it may be time for another look at Nexe and Enclose, since I don't use the additional JXcore features.

I note that enclose.js (http://enclosejs.com/ https://www.npmjs.com/package/enclose) is not open source, and is only free for evaluation purposes:

You agree not to install or use any individual copy of EncloseJS on more than one computer at a time and not via any network or by means of remote or other access. This provision is only for individual copies and does not apply to multi-system licenses or evaluation version. If EncloseJS was purchased by your employer You agree to get your's employer's explicit permission before installing EncloseJS on multiple computers as described here.

Enclose works with four specific versions (today): 0.12.7, 2.5.0, 4.2.2, 5.1.0.

I had trouble using Enclose with express.io. There may be a solution but I didn't explore too far.

Nexe (https://www.npmjs.com/package/nexe) is open source with an MIT license. The site notes a few additional limitations, such as not working with native modules, and only traversing "simple" requires, but I suspect these are the same as for Enclose. You can choose any version of node, and Nexe seems to download the node source and build everything from scratch, which takes some time (17 minutes the first time, and 4 minutes to recompile with no changes).

Nexe gave me warnings for express.io. For a trivial 4-line app, using the default options (latest node 5.1.0), the exe didn't work - complaining about not being able to find module ./lib.

var app = require('express.io')();
app.http().io();
app.listen(8081);
app.get('/',function(req,res){res.send('Hi!');});

But when I changed it to exclude the express.io module, it worked in Nexe.

var module = 'express.io';
var app = require(module)();
app.http().io();
app.listen(8081);
app.get('/',function(req,res){res.send('Hi!');});

I found that moving away from express.io (which seems to be unmaintained for over a year), my app could be compiled by Enclose, but not by Nexe:

var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io')(server);
app.get('/',function(req,res){res.send('Hi!');});
server.listen(8081);

Both Nexe and Enclose appear to have similar popularity/download statistics.

like image 108
John Avatar answered Oct 06 '22 04:10

John