Skip to content

Commit

Permalink
search default system paths last (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip authored and SBoudrias committed Jul 31, 2017
1 parent 8efc379 commit e924a99
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -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']));
Expand Down

0 comments on commit e924a99

Please sign in to comment.