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

npm_config_userconfig from environment variables is being overwriten #118

Open
6 of 7 tasks
mattmess1221 opened this issue Jun 11, 2024 · 1 comment
Open
6 of 7 tasks
Labels
help wanted Extra attention is needed pr welcome

Comments

@mattmess1221
Copy link

Describe the bug

I keep my npm config in $XDG_CONFIG_HOME/npm/config, which requires me to set npm_config_userconfig="${XDG_CONFIG_HOME:-$HOME/.config}/npm/config" in my shell.

But you overwrite it here.

setCliOption('userconfig', path.join(npmcliConfig.home, '.npmrc'))

I keep my registry configuration in that file, so changing that causes a FetchError: request to https://registry.npmjs.org/xxx failed, reason: read ECONNRESET

Reproduction

https://github.com/killjoy1221/taze/blob/ba87727b2d70e9e527f53ee83aa537d38c1d1a1f/test/envUserConfig.test.ts

System Info

% npx envinfo --system --binaries --browsers

  System:
    OS: Linux 5.14 Red Hat Enterprise Linux 9.4 (Plow)
    CPU: (4) x64 Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz
    Memory: 3.63 GB / 7.51 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 20.12.1 - ~/.local/share/nvm/versions/node/v20.12.1/bin/node
    npm: 10.5.0 - ~/.local/share/nvm/versions/node/v20.12.1/bin/npm
    pnpm: 9.1.0 - ~/.local/share/nvm/versions/node/v20.12.1/bin/pnpm

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)
@mattmess1221 mattmess1221 changed the title npm_config_userconfig is overwriting config set from environment variables npm_config_userconfig from environment variables is being overwriten Jun 11, 2024
@antfu
Copy link
Member

antfu commented Jul 13, 2024

I don't use this myself, could you send a quick PR if you already have the fix? Thanks

@antfu antfu added help wanted Extra attention is needed pr welcome labels Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed pr welcome
Projects
None yet
Development

No branches or pull requests

2 participants