This is just learning journal for myself and I welcome any help from the public to improve my understanding.
Whether a globally or locally installed module, eventually it will reside within a node_modules directory. The contents of this gist is scopped within the local node_modules of an application's directory. Now within the local node_modules there should always exist a .bin folder that houses all the excutable files.
What I've gathered thus far:
- On Unix/macOs, this files have the 
chmod755 or 777 permissions to run as scripts. - All of these files start with 
#!/usr/bin/env nodeon the very first line. - These files do not require any file extensions (perhaps they are scripts).
 
Experimented with
- 
Created a file
Fooin a local./node_modules/.bin#!/usr/bin/env node console.log("Hello ${process.argv[2]}") //Because process.argv's first and second element are reserved for Node.js
 - 
From a shell session, run
chmod 755 ./node_modules/.bin/foofrom the application's directory. - 
Include
"foo": "foo World!"in the associatedpackage.json - 
Run
npm run fooin shell. This should returnHello World!in the terminal