npm / npm/cli

[BUG] _npmUser value via npm view command return value is inconsistent

Open
#8,386 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Priority 2
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

If I run the npm view <packagename> --json command on random different packages I will sometimes get a different _npmUser JSON output.

Usually, its a single line like this:
"_npmUser": "seijdeleon <sdeleon@berkeley.edu>",

But sometimes it's nested JSON:

  },
  "_npmUser": {
    "name": "openwalletfoundation",
    "email": "npm@openwallet.foundation",
    "actor": {
      "name": "openwalletfoundation",
      "email": "npm@openwallet.foundation",
      "type": "user"
    }
  },
Expected Behavior

I expect to get the same JSON format from the npm view command, but it appears as though some users are being treated differently.

Steps To Reproduce

Let me give you a few examples:

npm view buildkite --json | jq -r '._npmUser'
acegik nttduong77@gmail.com

npm view @blueskyproject/finch --json | jq -r '._npmUser'
seijdeleon sdeleon@berkeley.edu

npm view @bifold/core --json | jq -r '._npmUser'

{
    "name": "openwalletfoundation",
    "email": "npm@openwallet.foundation",
    "actor": {
       "name": "openwalletfoundation",
       "email": "npm@openwallet.foundation",
       "type": "user"
     }
}

As you can see, sometimes the npmUser value is a nested JSON object, and sometimes it isn't. This nested behaviour is new, and I just started seeing it in the last week or two. I'm assuming it is an API configuration change, but it affects the NPM CLI so I'm reporting it as a bug here.
There doesn't seem to be any distinction between an org or scoped NPM account or a non-scoped account, so I honestly don't know what the distinction is between users that are nested and ones that aren't.

Environment
  • npm: 24.3.0
  • Node.js: 11.4.2
  • OS Name: MacOS Sequoia
  • System Model Name:
  • npm config:
prefix = "/usr/local"
; "user" config from /Users/REDACTED/.npmrc

//registry.npmjs.org/:_authToken = (protected)
registry = "https://registry.npmjs.org/"

; node bin location = /usr/local/Cellar/node/24.3.0/bin/node
; node version = v24.3.0
; npm local prefix = /Users/REDACTED/projects/githax
; npm version = 11.4.2
; cwd = /Users/REDACTED/projects/githax
; HOME = /Users/REDACTED
; Run `npm config ls -l` to show all defaults

This same issue is happening on all versions of npm and node that I've tested.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported commands, npm view <packagename> --json and the three package examples, then compare the _npmUser values returned. Trace the npm view output path and determine whether the differing registry responses can be normalized; done means the command returns a consistent JSON shape for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.