Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.npmrc files are not merged in package_metadata.ts #21406

Closed
1 of 15 tasks
Wintermoose opened this issue Jul 22, 2021 · 1 comment · Fixed by #21408
Closed
1 of 15 tasks

.npmrc files are not merged in package_metadata.ts #21406

Wintermoose opened this issue Jul 22, 2021 · 1 comment · Fixed by #21408
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Milestone

Comments

@Wintermoose
Copy link

🐞 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

@alan-agius4 alan-agius4 added area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix labels Jul 22, 2021
@ngbot ngbot bot modified the milestone: Backlog Jul 22, 2021
clydin pushed a commit that referenced this issue Jul 23, 2021
clydin pushed a commit that referenced this issue Jul 23, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants