Node.js Prep for OpenROV

OpenROV is an underwater robot controlled through a web browser. The server-side of the web app is written in Node.js, running on a BeagleBone Black inside the OpenROV.

You don’t need to know Node.js in order to pilot an OpenROV. And you don’t need to do anything in this article to construct an OpenROV from a kit. But if you’re the kind of maker who likes to dig deep into a project, you might enjoy exploring Node.js.

Mac OS X and Node.js

Everything written here applies to Node.js as it runs on Mac OS X. If your local machine runs Linux or Windows, you will need to consult other resources in order to run Node locally.

Homebrew First

Make sure you’re running Homebrew on your Mac. Homebrew is a seamless way to manage packages on Mac OS X. To install Homebrew…

$ ruby -e "$(curl -fsSL"install

After installation, confirm that Homebrew is running properly…

$ brew doctor

Installing Node.js

Now that Homebrew is installed and running, Node.js can be installed with a single line command.

$ brew install node

To confirm that Node.js is installed on your system and to check the version number…

$  which node

$ node --version


Hello World in Node.js

You know the compter science tradition: The first program in any new language has to say “Hello World.” Here’s a sample Hello World program from the official Node.js web site, slightly modified to suit OpenROV.

First, create a file called helloworld.js and fill it with the following code.

// Sample web server from, slightly modified.

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World. OpenROV runs Node.js!');
}).listen(1337, '');
console.log('Server running at');

Next, from the same directory where you saved helloworld.js, run the file from the command line like so…

$ node helloworld.js
Server running at


Finally, open up a web browser on your local machine and navigate to You should see a bare-bones web page similar to this one.

Now that you have Node.js running locally, you’re ready to explore the OpenROV repo on GitHub.

Next Steps

Future blog posts about Node.js and OpenROV will consider questions like:

Keep exploring!