Problem: Node.js command line program doesn't run. I followed this tutorial loosely. I run OSX, and let's say the program is filesearch.js.
$ filesearch
Returns
$ /usr/local/bin/filesearch: line 1: /Applications: is a directory
$ /usr/local/bin/filesearch: line 2: Gruntfile.js: command not found
$ /usr/local/bin/filesearch: line 3: Gruntfile.js: command not found
$ /usr/local/bin/filesearch: line 4: Gruntfile.js: command not found
$ /usr/local/bin/filesearch: line 5: syntax error near unexpected token `('
$ /usr/local/bin/filesearch: line 5: ` * Copyright (c) 2014 User Names'
It doesn't matter what code is in the program file, or what command line arguments i use, I get the same stdout every time.
I installed grunt and grunt-cli using
npm install grunt
npm install grunt-cli -g
Also installed grunt-init and the Node template
npm grunt-init -g
and placed the template in ~/.grunt_init where it is found by grunt-init
Initialized the grunt directory with
grunt-init node
I included the line in the program file to enable running as Node:
#!usr/bin/env node
Also symlinked the program directory with:
npm link
Why doesn't the program run?