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:
# 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:
# configure for installation:
# build and test:
make && make test
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:
And now put your scripts in
/opt/X/scripts and remember to start them with a line:
(for a given version)
(using your symlink)
/opt/X/scripts to your
PATH by using something like:
somewhere where you set up the
.bashrc) will make it easy to execute your scripts. If you want both your scripts and
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).
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).