Skip to content

Commit e924a99

Browse files
jchipSBoudrias
authored andcommittedJul 31, 2017
search default system paths last (#85)
1 parent 8efc379 commit e924a99

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
 

‎lib/resolver.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ resolver._tryRegistering = function (generatorReference) {
106106
resolver.getNpmPaths = function () {
107107
let paths = [];
108108

109+
// Default paths for each system
110+
if (win32) {
111+
paths.push(path.join(process.env.APPDATA, 'npm/node_modules'));
112+
} else {
113+
paths.push('/usr/lib/node_modules');
114+
paths.push('/usr/local/lib/node_modules');
115+
}
116+
109117
// Add NVM prefix directory
110118
if (process.env.NVM_PATH) {
111119
paths.push(path.join(path.dirname(process.env.NVM_PATH), 'node_modules'));
@@ -128,14 +136,6 @@ resolver.getNpmPaths = function () {
128136
paths.push(path.join(path.dirname(process.argv[1]), '../..'));
129137
}
130138

131-
// Default paths for each system
132-
if (win32) {
133-
paths.push(path.join(process.env.APPDATA, 'npm/node_modules'));
134-
} else {
135-
paths.push('/usr/lib/node_modules');
136-
paths.push('/usr/local/lib/node_modules');
137-
}
138-
139139
// Walk up the CWD and add `node_modules/` folder lookup on each level
140140
process.cwd().split(path.sep).forEach((part, i, parts) => {
141141
let lookup = path.join.apply(path, parts.slice(0, i + 1).concat(['node_modules']));

0 commit comments

Comments
 (0)
Please sign in to comment.