diff --git a/lib/module.js b/lib/module.js index 77a2a8d182..edca95bd4e 100644 --- a/lib/module.js +++ b/lib/module.js @@ -515,9 +515,10 @@ Module._initPaths = function() { paths.unshift(path.resolve(homeDir, '.node_modules')); } - if (process.env['NODE_PATH']) { + var nodePath = process.env['NODE_PATH']; + if (nodePath) { var splitter = isWindows ? ';' : ':'; - paths = process.env['NODE_PATH'].split(splitter).concat(paths); + paths = nodePath.split(splitter).concat(paths); } modulePaths = paths;