I am goign to write a few scripts for managing tasks via command line on the servers.

I will use the NodeJS Debian package in servers that support it, but I have a few servers still in Debian 3.1 (sarge).

I know that these servers have the Rhino package, the scripts I write may still run the same way on Rhino? (considering I do not use new JavaScript features that may not be available)

If not, what interpreter can I use for JS command line scripting on older Debians that will be compatible with the scripts I run via NodeJS on the newer Debians?

1 Answer 1


I don't think it would be possible to write anything non-trivial that would work on both new Node.js and old Rhino.

But if you are able to install packages on those old systems then you are presumably also able to install software from source (at least you have to if you want to install your own software there).

Installing Node from source is not difficult - see my recent answer about installing Node from source (see the Update part). You can even install Node specifically along your own scripts to not clobber the file system.

For example, let's say that you want to install your scripts in /opt/X (substitute a better name for X), you might do it like this:

# create a directory:
mkdir -p /opt/X/node-src

# change dir:
cd /opt/X/node-src

# download the Node source:
curl -O https://nodejs.org/dist/v4.4.5/node-v4.4.5.tar.gz

# extract the archive:
tar xzvf node-v4.4.5.tar.gz

# go into the extracted dir:
cd node-v4.4.5

# configure for installation:
./configure --prefix=/opt/X/node-v4.4.5

# build and test:
make && make test

# install:
sudo make install

# make a symlink to that version:
sudo ln -svf /opt/X/node-v4.4.5 /opt/X/node

# create a directory for your scripts:
mkdir /opt/X/scripts

And now put your scripts in /opt/X/scripts and remember to start them with a line:


(for a given version)



(using your symlink)

Adding /opt/X/scripts to your PATH by using something like:


somewhere where you set up the PATH (like .profile or .bashrc) will make it easy to execute your scripts. If you want both your scripts and node/npm binaries easily executable you can set the PATH like this instead:


Of course you can change the "X" to a better name, or install node in /opt/node like I described here or anywhere else if you want (of course remember to put your own paths in the commands above).

That way you can have a modern, secure and consistent version of Node on your machines. This is what I would recommend in this situation because writing that code that would work on new and old Node and on Rhino (and do anything useful) doesn't seem easy or even possible. Node is not only JavaScript but also a complicated I/O system, libuv and the entire ecosystem of npm modules.

As the old saying goes, "It's easier to port a shell than a shell script" (Larry Wall) so in your case it may be actually easier to install Node along with your scripts than to write your scripts in a way that would work without Node (though if you manage to do it then please post a comment here, I would certainly want to know how you did it).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .