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

ng add not authenticating with internal registry on v12 #21142

Closed
1 of 15 tasks
pascal-puetz opened this issue Jun 17, 2021 · 5 comments
Closed
1 of 15 tasks

ng add not authenticating with internal registry on v12 #21142

pascal-puetz opened this issue Jun 17, 2021 · 5 comments
Labels
area: angular/cli freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Milestone

Comments

@pascal-puetz
Copy link

pascal-puetz commented Jun 17, 2021

🐞 Bug report

After updating to v12, ng add breaks when used with our private npm registry.

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, the previous version in which this bug was not present was: <= v11

Description

When running ng add while NPM Registry is set to an internal Registry, the internal Registry is used but authentication information seems to be missing. This happens with both, yarn and npm. Running npm install or yarn install directly does work though.

🔬 Minimal Reproduction

Set npm to use a private Registry that needs Basic authentication and run ng add. This will fail while running npm install or yarn install directly does not.

registry=https://some-private-repo.com/repository/
always-auth=true
_auth="<AUTH_TOKEN>"

🔥 Exception or Error


ng add @angular/pwa                                                                                                                                                                                                
ℹ Using package manager: yarn
✖ Unable to load package information from registry: Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"

🌍 Your Environment





     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.0.4
Node: 14.17.0
Package Manager: npm 6.14.13
OS: darwin x64

Angular: 12.0.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                                        Version
---------------------------------------------------------
@angular-devkit/architect           0.1200.2
@angular-devkit/build-angular   12.0.1
@angular-devkit/core                  12.0.2
@angular-devkit/schematics       12.0.4
@angular/cli                                12.0.4
@schematics/angular                  12.0.4
rxjs                                               6.6.7
typescript                                     4.2.4
webpack                                      5.37.1

Anything else relevant?

@alan-agius4
Copy link
Collaborator

Hi,

As a workaround can you try to update the .npmrc to below

//some-private-repo.com/repository:/_auth="<AUTH_TOKEN>"
registry=https://some-private-repo.com/repository/

@alan-agius4 alan-agius4 added area: angular/cli freq1: low Only reported by a handful of users who observe it rarely severity5: regression labels Jun 17, 2021
@ngbot ngbot bot modified the milestone: needsTriage Jun 17, 2021
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Jun 17, 2021
@alan-agius4
Copy link
Collaborator

Closed via #21140

@pascal-puetz
Copy link
Author

Thanks, this works!
Just a tiny addition for anyone finding this issue:
//some-private-repo.com/repository:/_auth="<AUTH_TOKEN>" needs to be
//some-private-repo.com/repository:_auth="<AUTH_TOKEN>" (without the / in front of _auth)

@alan-agius4
Copy link
Collaborator

@pascal-puetz,

Oops typo, the slash should be before the colon.

- //some-private-repo.com/repository:/_auth="<AUTH_TOKEN>"
+ //some-private-repo.com/repository/:_auth="<AUTH_TOKEN>"

@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 Jul 18, 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

No branches or pull requests

2 participants