nodejs-nxt is a Node.js package to control the LEGO MINDSTORMS NXT with an USB cable or a Bluethooth connection.
I used the official communication protocol, which communicates with the nxt over its serial port. You can find the documentation here.
Nodejs-nxt could be installed with a simple
$ npm install nodejs-nxt
The following example code connects with the NXT through the serial port '/dev/tty.NXT-DevB', plays a tone with 1000 Hz for 2 seconds and then disconnects.
var nxt = ;var nxt0 = '/dev/tty.NXT-DevB' true;nxt0;
Nodejs-nxt needs the package node-serialport to communicate with the NXT.