0

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?

ShaharZ
  • 389
  • 5
  • 11

1 Answers1

0

Include the suffix to the end of it.

$ filesearch.js

EDIT:

Sorry this part below may be useless. But if necessary reinstall these components in the program directory.

Also install grunt via npm:

npm install grunt 

Then do:

npm install grunt -g cli

Make sure you have navigated to the desired directory with the cd command on terminal.

Further documentation found here: http://gruntjs.com/getting-started

nonamorando
  • 1,556
  • 2
  • 14
  • 33