From f07041e6cd26b3e3617deccf6d8df86cb7c9d750 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 11 Feb 2011 15:53:22 -0800 Subject: [PATCH] Make the repl respect node_modules folders. This is important so that in the future, this will work: $ cd ~/dev/js/some-project $ npm install redis $ node > require.resolve('redis') '/Users/isaacs/dev/js/some-project/node_modules/redis/index.js' --- lib/repl.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/repl.js b/lib/repl.js index c258bb03e1..447192e950 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -36,6 +36,9 @@ if (process.platform != 'win32') { // hack for require.resolve("./relative") to work properly. module.filename = process.cwd() + '/repl'; +// hack for repl require to work properly with node_modules folders +module.paths = require('module')._nodeModulePaths(module.filename); + function resetContext() { context = vm.createContext();