Reputation: 78
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?
Upvotes: 0
Views: 53
Reputation: 3531
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
Upvotes: 1