I have a directory that looks like this:
-- app/
|- models/
|- user.js
|- config.json
I want my user.js file to re
It seems like the module-loading functionality prepends node_modules/ to the argument. For example, place the following script into /tmp/t.js:
meow = require('meow/meow.js');
create (mkdir) the /tmp/node_modules/ and try running it with BSD's ktrace (or Linux' strace, which provides comparable functionality). Node will attempt to open the following:
/tmp/node_modules/meow/meow.js/tmp/node_modules/meow/meow.js.js/tmp/node_modules/meow/meow.js.json/tmp/node_modules/meow/meow.js.node/tmp/node_modules/meow/meow.js/package.json/tmp/node_modules/meow/meow.js/index.js/tmp/node_modules/meow/meow.js/index.json/tmp/node_modules/meow/meow.js/index.nodeIf you do not have the node_modules/ subdirectory next to your script, it will not lookup anywhere relative to your script at all.