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: Registry config without auth comment fails #26152

Closed
saibotk opened this issue Oct 11, 2024 · 2 comments · Fixed by #26473
Closed

npmrc: Registry config without auth comment fails #26152

saibotk opened this issue Oct 11, 2024 · 2 comments · Fixed by #26473
Assignees
Labels
bug Something isn't working correctly install node compat

Comments

@saibotk
Copy link

saibotk commented Oct 11, 2024

Version: Deno 2.0.0

Currently, when running any deno command, it fails with this message:

DENO_LOG=debug deno task
DEBUG RS - deno_config::workspace::discovery:266 - package.json file found at '/Users/saibotk/git/test/package.json'
error: Failed to resolve .npmrc options

Caused by:
    failed resolving .npmrc config for scope 'demo'

The .npmrc that is causing the issue:

# Force registry to be npmjs.org
@demo:registry=https://registry.npmjs.org/

Quick usage rationale: When using a custom internal company registry for some projects, which is globally defined for a company scope, we sometimes need to reset it to use the npm registry, e.g. when projects are shared with clients that also need access and all used packages from that scope are also published publicly. This then prevents pnpm or npm from resolving them via the internal registry.

The workaround

The issue here seems that deno expects a registry definition to be followed by the auth credential definition. Sadly the error message here only tells me that some error happened but not what it expected.

The following works

# Force registry to be npmjs.org
@demo:registry=https://registry.npmjs.org/
//registry.npmjs.org/:_auth=

Thanks for the amazing project!

@nathanwhit nathanwhit added the bug Something isn't working correctly label Oct 11, 2024
@wesleylhandy
Copy link

The workaround does not work for global npm config that is not sourced by an .npmrc

@bartlomieju
Copy link
Member

FYI you can upgrade to canary version to get this fix immediately (deno upgrade canary) or wait until stable Deno v2.0.3 that should be released tonight.

bartlomieju added a commit that referenced this issue Oct 25, 2024
We weren't passing the resolved npmrc settings to the install commands.
This lead us to always fall back to the default registry url instead of
using the one from npmrc.

Fixes #26139
Fixes #26033
Fixes #25924
Fixes #25822
Fixes #26152

---------

Co-authored-by: Bartek Iwańczuk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly install node compat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants