How to get my module to work globally? Is there any config in package.json?

I have a very simple module that I want to use globally. I have already published it to npm as gammarouter-api.

  1. I would like to know how can I test the module globally before publishing to npm (is npm link the answer?)

  2. I noticed that all the modules that I install globally (I have no problems using any third party modules globally) goes to the folder /user/local/lib/node_module BUT my path does not contains this folder but /usr/local/bin, where I can find some files related to the global installed modules.

    When I install my module with npm install -g gammarouter-api the folder gammarouter-api is created at /user/local/lib/node_module but nothing goes to /usr/local/bin, thats why its unreachable. Is there any setting/configuration/trick for this to work?

  1. Use npm install . -g in the root of a module to install it globally. See the docs.
  2. The bin property in you package.json is used to specify which executables should be added to the PATH. See the docs.

For example:

{
  "name": "my-module",
  "bin": "./bin/script.js"
}