I found a Bash script today that uses the env command to launch Node.JS. The script requires two packages and then uses the second package to parse the process command line arguments before launching node as shown below:
#! /usr/bin/env node
'use strict';
require('zos-lib').Logger.silent(false);
require('./program').parse(process.argv);
I can't find a module/package named './program' anywhere in my file system. Can someone tell me where the program module/package is and what it does? I tried many Google searches but unfortunately program is such a common keyword that I'm not finding anything useful.
UPDATE: slebetman's answer is correct. I wanted to explain why I couldn't find the program module in this update, in case it helps others. As soon as I read his answer about that script being a Javascript script and to look for program.js not program I found it by searching the directory tree from the top level Node.js directory with this command:
$ find . -iname program.js
Unfortunately for me, what you see below is what I tried the first time and that does not produce any output:
$ find . -iname program
The script you found is not a bash script. It is a javascript script. Specifically it is a script written in javascript for node.js.
In node's require
system, a module name that begins with ./
means that the module is in the same folder as the script.
You haven't told us the file name of the script you posted. But lets assume it's called myscript.js
. Then the folder structure should be:
/whatever/folder/myscript.js
/whatever/folder/program.js
or
/whatever/folder/myscript.js
/whatever/folder/program/index.js
or
/whatever/folder/myscript.js
/whatever/folder/program/package.json
/whatever/folder/program/whatever_script_name.js
If you cannot find the file program.js
or the folder program
in the same folder as the script you are looking at then you haven't copied the script properly (you forgot to copy the "program" file or folder).