0

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?

1
  • i think its because you dont have bin directory in your module directory Commented Jun 25, 2016 at 8:59

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.