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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

With version 12.2, the dependencies no longer install behind corporate registry #21529

Closed
15 tasks done
woppa684 opened this issue Aug 9, 2021 · 7 comments
Closed
15 tasks done
Labels
needs: more info Reporter must clarify the issue

Comments

@woppa684
Copy link

woppa684 commented Aug 9, 2021

馃悶 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, it works in the latest 12.1

Description

The esbuilder dependency tries to install its own dependencies in a post-install script and fails behind a corporate proxy / registry. See these (maybe related) issues: evanw/esbuild#1382 evanw/esbuild#1485, apparently this is correct behavior, but now it affects angular CLI as well.

馃敩 Minimal Reproduction

I cannot create an online repoduction of this.

馃敟 Exception or Error


> esbuild@0.12.17 postinstall C:\Repos\myrepo\node_modules\esbuild
> node install.js

Trying to install "esbuild-windows-64" using npm
Failed to install "esbuild-windows-64" using npm: Command failed: npm install --loglevel=error --prefer-offline --no-audit --progress=false esbuild-windows-64@0.12.17
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="http://ourcorporateregistry", Negotiate, NTLM

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2021-08-09T05_52_58_429Z-debug.log

Trying to download "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.12.17.tgz"
Failed to download "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.12.17.tgz": connect ECONNREFUSED 104.16.22.35:443

馃實 Your Environment


Angular CLI: 12.2.0
Node: 12.21.0
Package Manager: npm 6.14.11
OS: win32 x64

Angular: 12.2.0
... cli, compiler, compiler-cli, core, language-service

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1202.0
@angular-devkit/build-angular   12.2.0
@angular-devkit/core            12.2.0
@angular-devkit/schematics      12.1.3
@schematics/angular             12.1.3
ng-packagr                      12.2.0
rxjs                            6.6.7
typescript                      4.3.5

Anything else relevant?
64-bit Windows 10 behind a corporate (Azure Artifacts) registry

@woppa684
Copy link
Author

woppa684 commented Aug 9, 2021

It might be worth mentioning that we use project-level .npmrc files and that the postinstall script of esbuild tries to use the global .npmrc file (which might be the intended usage?). Anyway, current workaround is to manually copy my project-specific .npmrc file to the global location before running npm install.

@alan-agius4
Copy link
Collaborator

I believe adding always-auth = true to your npmrc file should fix this.

Can you please try?

@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label Aug 9, 2021
@woppa684
Copy link
Author

woppa684 commented Aug 9, 2021

Yes we already have this, it really is about the fact that we use project-specific .npmrc files and that a postinstall script that just calls npm will use the global .npmrc (as described above). This is probably not something that can be fixed at Angular CLI level so I think I can better close this? It was just a very unpleasant surprise when upgrading to the new CLI. We have had similar things with other libraries trying to download packages by themselves (e.g. node-sass) but there were other workarounds for that.

@alan-agius4
Copy link
Collaborator

Indeed, I don't see this as being actionable from our end. That said, the fact that it doesn't use the local NPMRC files seem like a different ESbuild bug.

This is caused because the CWD is changed from the project root to a temp directory, which caused the local NPMRC files not to be read by NPM/Yarn.

See: https://github.com/evanw/esbuild/blob/eb2872e1ab4ae09bef6fae71db6eb2381ede131b/lib/npm/install.ts#L178

I also suggest to subscribe to evanw/esbuild#789

@bgotink
Copy link
Contributor

bgotink commented Sep 6, 2021

For what it's worth, we've "solved" this issue by adding a resolution replacing esbuild with the slower esbuild-wasm. I don't think npm supports this, but we use yarn which does have this capability (docs).

"resolutions": {
  // replace 0.12.17 with the version of esbuild your angular version is using
  "esbuild@0.12.17": "npm:esbuild-wasm@0.12.17"
}

@woppa684
Copy link
Author

@alan-agius4 I see that the esbuild bug you mentioned should be solved. Does that also mean that it is also solved in Angular CLI? And it is only solved in v13 then, right? I see 12.2.7 still uses a 0.12.x version of esbuild. If this is the case, would it be possible to put the fixed version in 12.2.8 (if there is still a version coming up)? Upgrading to Angular 13 is not planned soon for our company.

@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 Oct 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests

3 participants