I have a node app with a package.json
file declaring my dependencies.
I've run npm install
to install those deps to a local node_modules
folder, and when I run my app, everything works great.
The problem is when I try to spike out some new functionality by firing up the node REPL:
$ node
> require('hubot');
Error: Cannot find module 'hubot'
In the REPL, it doesn't seem to know to look inside node_modules
. Is this expected behavior, or is hubot weird?
You can set the env variable NODE_DEBUG
to see the paths that are tried by node:
export NODE_DEBUG=module
> require('toto')
Module._load REQUEST toto parent: repl
looking for "toto" in ["/Users/laurent/repl/node_modules","/Users/laurent/node_modules","/Users/node_modules","/node_modules","/lusr/local/bin/node","/Users/laurent/.node_modules","/Users/laurent/.node_libraries","/usr/local/lib/node"]