I am writing a basic command line utility using node in Windows. Here is the file kevin.js
#!/usr/bin/env node
console.log("Hello");
Below is my package.json
{
"name": "kevin",
"version": "0.0.0",
"preferGlobal": "true",
"bin":{
"kevin":"kevin.js"
}
}
When I execute node kevin.js it works. npm link command also works fine. But when i try to execute my command kevin, it does not execute, instead opens the file in Notepad.
You can associate a file extension with a default "runtime" environment.
See my explanation on how to do it here: http://stackoverflow.com/a/6818266/330315
Once you have done it, you can simply type "kevin" in the commandline and it will be executed using node.js
you can create kevin.cmd (or kevin.bat) with the command to run your tool (e.g.: node kevin.js) and put it somewhere in the system PATH. That's what most of the tools do (like uglifyjs, less, etc.).