Description
🐞 Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes, this seems to be new issue in 12.1.3
Description
The configuration-loading code in package-metadata.ts no longer merges options loaded across multiple .npmrc files. This means that if the updated project contains .npmrc with less options than the $home .npmrc (typically: contains registry configuration, but not authentication tokens), the attempt to fetch metadata will fail.
In our case, this results in failed authorization and abort of the update process (the error message comes from azure, which is what we use to host our repo)
ng update @angular/cli @angular/core --force --allow-dirty
The installed local Angular CLI version is older than the latest stable version.
Installing a temporary version to perform the update.
✔ Package successfully installed.
Using package manager: 'npm'
Collecting installed dependencies...
Found 82 dependencies.
Fetching dependency metadata from registry...
Error fetching metadata for '@angular/cli': Unable to authenticate, need: Bearer authorization_uri=https://login.windows.net/XXX, Basic realm="https://pkgsprodXXXXX.app.pkgs.visualstudio.com/", TFS-Federated
🔬 Minimal Reproduction
Given the authorization requirements, your steps might differ, but basically
- take project using angular 12.1.2 (or older)
- place .npmrc file with any option inside the project
- have also .npmrc file with authorization (or other crucial info) configuration your home/profile folder
- run ng update @angular/cli @angular/core
🔥 Exception or Error
Error fetching metadata for '@angular/cli': Unable to authenticate, need: Bearer....
🌍 Your Environment
Angular CLI: 12.1.2
Node: 12.18.2
Package Manager: npm 6.14.11
OS: win32 x64
Angular: 12.1.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1201.1
@angular-devkit/build-angular 12.1.2
@angular-devkit/core 12.1.1
@angular-devkit/schematics 12.1.2
@schematics/angular 12.1.2
ng-packagr 12.1.0
rxjs 6.6.7
typescript 4.3.5
Anything else relevant?
The problem seems to be caused by this commit 6b00d12#diff-1fe35077f343d441cac1946e85d88adf8808fa6b3a0898e85209cc7143e6b9c0
Notice how the original code kept on updating the options variable in the loop across configuration files, but the new one doesn't merge it anywhere
Package manager: npm