Tsalikidis Tsalikidis - 10 months ago 38
Node.js Question

Writing command line tool with node

I'm trying to create a command line tool with node (following these instructions).

So I add "bin" to package.json file

"bin": {
"test": "./index.js"

Created index.js file

#!usr/bin/env node

And I use
$ sudo npm link

Finally I try to run it via terminal but I'm getting
-bash: /usr/local/bin/test: usr/bin/env: bad interpreter: No such file or directory

Any ideas anyone?


I don't think npm link is needed in this case; you normally would use it to connect a module from your file system that you might otherwise pull in via the npm install command.

Your shebang syntax looks off to me, though, missing the leading slash:

#!/usr/bin/env node