Skip to content
jfraboni edited this page Jun 23, 2014 · 2 revisions

Shebang

When writing our simple node apps, we’ll always include this line at top of javascript files:

#!/usr/bin/env node

On Unix like operating systems, this is called a Shebang, and is a sequence of characters located at the top of a file that start with:

#!

...and are followed by the directory path to, and name of, the interpreter that will run the script, in this case node. This allows us the run the script from the command line without having to explicitly state WHICH application we want to run our file. Normally, you'd have to do this:

$ node simple-node-app.js

...we can type:

$ ./simple-node-app.js

We've included the Node.js Shebang at the top of all our simple node lessons, so you don't have to type it now.

© John Fraboni 2014

Clone this wiki locally