When I call my node module from the command line when it is installed globally I get an error saying it
could not find /node_modules/insect-tool/cli.js
I check in the global node modules folder and it is there. How do I fix this?
Its happen because of you doesn't maintain the global module structure or problem with your pacakge.json file in main property you have to put cli.js instead of index.js
package.json main accept entry point of your module
Place your entry javascript file in bin directory
follow this link for more info
Sample
package.json
{
"author": "Uzaif nilger",
"license": "BSD",
"name": "test-module",
"version": "0.0.1",
"description": "This is my first module.",
"bin": {
"test-module-exec": "bin/test-module.js"
},
"main" : "cli.js",
"preferGlobal": "true"
}
hope its work for you
bindirectory in your module directory