Skip to content

npm_config_userconfig from environment variables is being overwriten #118

Open
@mattmess1221

Description

@mattmess1221

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!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions