Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] Version 7.x Nerfs JSON Output for Install Command #2773

Open
bdkjones opened this issue Feb 25, 2021 · 3 comments
Open

[BUG] Version 7.x Nerfs JSON Output for Install Command #2773

bdkjones opened this issue Feb 25, 2021 · 3 comments
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release

Comments

@bdkjones
Copy link

bdkjones commented Feb 25, 2021

Summary:

npm 7.x seriously nerfed the usefulness of the --json flag when paired with the install command. (It may have done so with other commands as well; I've only tested install.)

I do realize that --json is marked experimental for all commands other than ls and search, but this is a MASSIVE regression in usefulness. I can understand changing the structure of the returned JSON, etc. while the feature is experimental, but nuking all of the details and returning only the bare minimum summary information must be an inadvertent change, right?

This makes npm exceptionally difficult to integrate with build tools and scripts. I've rolled back from 7.x until this can be addressed. Thanks!

Current Behavior:

Using npm 7.5.3 run this command: npm install jquery --json

The output produced is:

{
  "added": 1,
  "removed": 0,
  "changed": 0,
  "audited": 2,
  "funding": 0,
  "audit": {
    "vulnerabilities": {
      "info": 0,
      "low": 0,
      "moderate": 0,
      "high": 0,
      "critical": 0,
      "total": 0
    },
    "dependencies": {
      "prod": 2,
      "dev": 0,
      "optional": 0,
      "peer": 0,
      "peerOptional": 0,
      "total": 1
    }
  }
}

Expected Behavior:

Here's what npm < 7 spits out for the same command.

Notice the detail in added—we can see what was done, not just how many things were done.

{
  "added": [
    {
      "action": "add",
      "name": "jquery",
      "version": "3.5.1",
      "path": "/Users/bdkjones/Desktop/untitled folder/node_modules/jquery"
    }
  ],
  "removed": [],
  "updated": [],
  "moved": [],
  "failed": [],
  "warnings": [],
  "audit": {
    "actions": [],
    "advisories": {},
    "muted": [],
    "metadata": {
      "vulnerabilities": {
        "info": 0,
        "low": 0,
        "moderate": 0,
        "high": 0,
        "critical": 0
      },
      "dependencies": 1,
      "devDependencies": 0,
      "optionalDependencies": 0,
      "totalDependencies": 1
    }
  },
  "funding": "",
  "elapsed": 745
}

Steps To Reproduce:

  1. Just run npm install [any package name] --json on npm 7.x and compare the output to npm 6.x and below.

Environment:

  • OS: macOS 11.2.1
  • Node: 14.15.1 and 15.10.0 (I tested both)
  • npm: 7.5.3
@bdkjones bdkjones added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Feb 25, 2021
@bdkjones
Copy link
Author

Sort-of related (in that another JSON thing got broken): #2740

@wraithgar wraithgar added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Mar 22, 2021
@bdkjones
Copy link
Author

Any progress on this? It's a very large regression from 6.x and I hate staying on an outdated version of npm.

@lukekarrys
Copy link
Contributor

Thanks for the report @bdkjones. I'm tracking down issues like this as we're working on a larger epic of how npm writes output to the terminal. This will likely come after that, but I agree that the additional information is very helpful.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

3 participants