I try to write a commandline app with node and want to install it with npm install -g
After that it is not possible to read out the process.argv array.
I tried this :
// print process.argv
process.argv.forEach(function(val, index, array) {
console.log(index + ': ' + val);
});
When I call node /bin/myprog parm1 it works.
When I call myprog parm1 no parms are passed.
Any idea to get the parent caller process.argvs? I am Using Windows 7.
I'm also on Windows 7, and I've created the following test package here and it works perfectly: https://gist.github.com/gustavohenke/5657481
Check if you're not forgetting about the first line in the mybin file.
Also, I strongly recommend for you to use nopt or commander for parsing your CLI options.
They turn this into an very easy and cool task!