From e9717e58120dc1c91ddb228a8f6d25b94e7401bf Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 16 Jun 2021 13:08:28 +0200 Subject: [PATCH] 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 --- packages/angular/cli/utilities/package-metadata.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/angular/cli/utilities/package-metadata.ts b/packages/angular/cli/utilities/package-metadata.ts index b872848270a8..403428111d79 100644 --- a/packages/angular/cli/utilities/package-metadata.ts +++ b/packages/angular/cli/utilities/package-metadata.ts @@ -120,9 +120,11 @@ function readOptions( ]; const projectConfigLocations: string[] = [path.join(cwd, dotFilename)]; - const root = path.parse(cwd).root; - for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = path.dirname(curDir)) { - projectConfigLocations.unshift(path.join(curDir, dotFilename)); + if (yarn) { + const root = path.parse(cwd).root; + for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = path.dirname(curDir)) { + projectConfigLocations.unshift(path.join(curDir, dotFilename)); + } } if (showPotentials) {