mnot / htracr

HTTP sniffing and low-level visualisation
MIT License
531 stars 37 forks source link

Port not recognised from command-line #5

Closed magicmonkey closed 13 years ago

magicmonkey commented 13 years ago

I installed htracr from NPM (version 0.1.1), but every time I ran it I just got faced with the usage message. A little bit of digging revealed that these lines in htracr.js were to blame:

// port to listen to 
var port = parseInt(argv._[0])
if (! port || port == NaN) {
  htracr.usage()
}

A console.log(util.inspect(argv)) showed this:

{ _: 
   [ '/usr/local/bin/node',
     '/usr/local/bin/htracr',
     '8004' ],
  '$0': 'coffee ' }

so I changed the code to:

// port to listen to 
var port = parseInt(argv._[2])
if (! port || port == NaN) {
  htracr.usage()
}

and the server ran ok (note the "0" changed to a "2"). I suspect that something to do with the NPM installer is adding the extra fields to argv?

mnot commented 13 years ago

That's a very old version of NPM; if you update this will work. I'll look into requiring a specific version of NPM in a future rev.

magicmonkey commented 13 years ago

Ah ok, cheers - I didn't realise my NPM was so out of date. I've updated it now :)

Thanks.

mnot commented 13 years ago

Try 0.1.2.