Skip to content

[BUG] Automatic authentification on private npm repository no longer works #3130

Closed
@yvon-dblg

Description

@yvon-dblg

Current Behavior:

We use a private nexus repository with an .npmrc file on each project.

Our .npmrc looks like (URL changed for this bug report):

registry=https://our-url.example.com/repository/npm/
_auth=${NEXUS_TOKEN_ENV_VAR}

Since the npm v7.11.0 release we have the following error when we do an npm install in our projects:

npm ERR! code E401
npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"

From a user point of view, this error is similar to the one found in v7.7.0, see #2935

Quick code check

It seems that the changes in npm-registry-fetch are not well integrated in the cli project.
The auth.js -> getAuth() seems to need the forceAuth object in that case.

Expected Behavior:

npm install works as expected.

Steps To Reproduce:

Configure a private repository with basics HTTP auth, and use it with a specific .npmrc in the project, like explain above.

Environment:

OS: Ubuntu 20.04

{
  npm: '7.11.0',
  node: '14.16.1',
  v8: '8.4.371.19-node.18',
  uv: '1.40.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.16.1',
  modules: '83',
  nghttp2: '1.41.0',
  napi: '7',
  llhttp: '2.1.3',
  openssl: '1.1.1k',
  cldr: '37.0',
  icu: '67.1',
  tz: '2020a',
  unicode: '13.0'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions