Skip to content

fix: respect npm_config_registry for update checks#1961

Closed
Will-hxw wants to merge 2 commits intoChromeDevTools:mainfrom
Will-hxw:fix/npm-registry-env-1943
Closed

fix: respect npm_config_registry for update checks#1961
Will-hxw wants to merge 2 commits intoChromeDevTools:mainfrom
Will-hxw:fix/npm-registry-env-1943

Conversation

@Will-hxw
Copy link
Copy Markdown

@Will-hxw Will-hxw commented Apr 27, 2026

Summary

Use npm_config_registry environment variable for npm registry URL in update checks, instead of hardcoding registry.npmjs.org.

Fix

check-latest-version.ts now respects the user's npm registry configuration. This helps users behind corporate proxies or using private registries (e.g., JFrog Artifactory).

When npm_config_registry is not set, falls back to the default public registry.

Validation

  • npm run build passes
  • npm test passes

Fixes #1943

Use the npm_config_registry env var (set by npm when invoked
via npx with custom registry config) instead of hardcoding
registry.npmjs.org. Falls back to the default public registry
when the env var is not set.

Fixes #1943
@Will-hxw
Copy link
Copy Markdown
Author

Hi @coty @precision , sorry to bother you. This PR has been open for a while, so I wanted to kindly check whether you might have time to review it or let me know if any changes are needed.I’m happy to make adjustments if required. Thanks!

@wolfib
Copy link
Copy Markdown
Contributor

wolfib commented Apr 27, 2026

Thanks!

As discussed in here, this does not solve the case where the DevTools CLI is called directly. @mathiasbynens WDYT? Should the suggestion from here be added?

@wolfib wolfib requested a review from mathiasbynens April 27, 2026 16:01
@mathiasbynens
Copy link
Copy Markdown
Member

Thanks!

As discussed in here, this does not solve the case where the DevTools CLI is called directly. @mathiasbynens WDYT? Should the suggestion from here be added?

Yeah, if we need to support this then let’s do it properly and support all use cases, not just those through npx or npm run.

The “proper” way to do it would be to use @npmcli/config, but this comes at the cost of a dependency.

@mathiasbynens mathiasbynens requested a review from OrKoN April 28, 2026 06:10
@Will-hxw
Copy link
Copy Markdown
Author

Thanks for the suggestion. Adding @npmcli/config as a dependency would indeed handle all cases properly, but you're right that it introduces a new dependency.

Given the PR is already behind and this would be a meaningful scope expansion, I think it makes sense to treat this as a follow-up PR rather than growing this one further. Would you be okay with merging the current fix as-is (for the npx/npm case) and addressing the direct-CLI case in a separate PR with the proper implementation?

@Will-hxw
Copy link
Copy Markdown
Author

@wolfib Thanks for the follow-up! The plan is to merge the current fix for the npx/npm case, then address the direct-CLI scenario in a follow-up with the proper @npmcli/config implementation. This keeps this PR focused and lets us do the full solution justice. I'll open a new issue to track the direct-CLI work after this merges.

Instead of only checking npm_config_registry env var (which is only
set when invoked via npx/npm), now uses `npm config get registry`
to read .npmrc regardless of how the CLI was started.

This addresses the maintainer's feedback that the original solution
did not work when DevTools CLI is called directly.
@Will-hxw Will-hxw force-pushed the fix/npm-registry-env-1943 branch from 52701f5 to 5462a96 Compare April 28, 2026 22:18
@Will-hxw Will-hxw closed this by deleting the head repository Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update check hardcodes registry.npmjs.org, ignoring user's npm registry configuration

3 participants