Windows ignores the shebang line #!/usr/bin/env node
and will execute it according to the .js
file association. Be explicit about calling your script with node
node hello.js
ps. Pedantry: shebangs aren’t in the POSIX standard but they are supported by most *nix system.
If you package your project for Npm, use the ‘bin’ field in package.json. Then on Windows, Npm will install a .cmd
wrapper along side your script so users can execute it from the command-line
hello
For npm to create the shim right, the script must have the shebang line #!/usr/bin/env node