nomnom icon indicating copy to clipboard operation
nomnom copied to clipboard

node ssmount: no such command 'node'

Open dantman opened this issue 10 years ago • 0 comments

I was porting a script (ssmount) I was working on from commander.js to nomnom (I wanted to set a dynamic default and wasn't happy with commander's limitation in the area).

I modified my one config option and one of my commands to use nomnom's syntax, after commenting out the others I wanted to check if there were any early call or syntax errors in what I had wrote. The program.parse(process.argv) that was written for commander was left behind since I was only checking for early errors, not full functionality. So I decided to simply run my script. And I ended up with this.

$ ssmount
node ssmount: no such command 'node'

I ended up mistakenly thinking that some sort of issue had popped up with either my shebang, npm link, or something was wrong with my PATH and somehow post env the node command couldn't be found. I did various things, linking /usr/local/bin/node to /usr/bin/node (digging myself a hole since that changed npm's install path) and at one point I even reinstalled nodejs.

Until I tried reverting my changes back to using commander and discovered that this message was actually being output by nomnom because process.argv's first arg was 'node'

I know part of it is my fault for using nomnom incorrectly (passing process.argv to nomnom's .parse method), but still, this is a REALLY REALLY confusing error message.

Given nomnom's nice fancy usage output couldn't the 'command not found' type errors be fancier or more useful, rather than the short confusing kind you'd expect to have been output by env or bash.

dantman avatar Jun 06 '14 23:06 dantman