diff --git a/lib/resolver.js b/lib/resolver.js index e78e961a..209515ab 100644 --- a/lib/resolver.js +++ b/lib/resolver.js @@ -106,6 +106,14 @@ resolver._tryRegistering = function (generatorReference) { resolver.getNpmPaths = function () { let paths = []; + // Default paths for each system + if (win32) { + paths.push(path.join(process.env.APPDATA, 'npm/node_modules')); + } else { + paths.push('/usr/lib/node_modules'); + paths.push('/usr/local/lib/node_modules'); + } + // Add NVM prefix directory if (process.env.NVM_PATH) { paths.push(path.join(path.dirname(process.env.NVM_PATH), 'node_modules')); @@ -128,14 +136,6 @@ resolver.getNpmPaths = function () { paths.push(path.join(path.dirname(process.argv[1]), '../..')); } - // Default paths for each system - if (win32) { - paths.push(path.join(process.env.APPDATA, 'npm/node_modules')); - } else { - paths.push('/usr/lib/node_modules'); - paths.push('/usr/local/lib/node_modules'); - } - // Walk up the CWD and add `node_modules/` folder lookup on each level process.cwd().split(path.sep).forEach((part, i, parts) => { let lookup = path.join.apply(path, parts.slice(0, i + 1).concat(['node_modules']));