Skip to content

Commit e9717e5

Browse files
alan-agius4clydin
authored andcommitted
fix(@angular/cli): don't resolve .npmrc from parent directories
Unlike `yarn`, `npm` doesn't resolve `.npmrc` from parent locations instead it looks in predefied locations in - per-project config file (/path/to/my/project/.npmrc) - per-user config file (~/.npmrc) - global config file ($PREFIX/etc/npmrc) - npm builtin config file (/path/to/npm/npmrc) https://docs.npmjs.com/cli/v7/configuring-npm/npmrc#files
1 parent 77c96f8 commit e9717e5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/angular/cli/utilities/package-metadata.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,11 @@ function readOptions(
120120
];
121121

122122
const projectConfigLocations: string[] = [path.join(cwd, dotFilename)];
123-
const root = path.parse(cwd).root;
124-
for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = path.dirname(curDir)) {
125-
projectConfigLocations.unshift(path.join(curDir, dotFilename));
123+
if (yarn) {
124+
const root = path.parse(cwd).root;
125+
for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = path.dirname(curDir)) {
126+
projectConfigLocations.unshift(path.join(curDir, dotFilename));
127+
}
126128
}
127129

128130
if (showPotentials) {

0 commit comments

Comments
 (0)