Skip to content

[BUG] npm view --json command returns not only JSON if failed #5444

Closed
@ThePlenkov

Description

@ThePlenkov

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

Use case

I have a monorepo with workspaces. Each workspace gets published to a separate package. In CI pipeline I want to check whether is module needs to be published or no. So to make a central decision which packages I need to publish I would love to know what are the most recent published versions. So what I do I run such a command npm view -ws --json to have a common list of published packages. In case if I add one more package which is not yet published - I get an error npm ERR! 404 Not Found

Expected Behavior

For a single request it makes sense - for a bulk mode - I would prefer to have this error as a part of json payload.

It's ok to have an additional flag to indicate that behavior.

Do you think is possible?

Thank you!

Steps To Reproduce

  1. Create a new monorepo with couple workspaces
  2. Publish them
  3. Add a new workspace
  4. Run npm view -ws --json

Environment

  • npm: 8.12.1
  • Node.js: v18.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issueRelease 8.xwork is associated with a specific npm 8 releaseconfig:displayIssues dealing with display of data to terminal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions