unix - I'm learning about shebangs. How do I make it work with node.js in a Mac terminal? -


i have:

#!/usr/bin/env node console.log("it works!"); 

i learned env finds node program , interprets node. checked env exists in /usr/bin.

when call node itworks.js works , outputs it works!. however, understand, should able call itworks.js without node due shebang. when make command says -bash: itworks.js: command not found.

could me shebang work?

first of need make file executable:

chmod +x itworks.js 

then need call specifying path well. either:

/where/it/is/on/disk/itworks.js 

or:

./itworks.js 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -