Skip to content

[BUG] npm search module_does_not_exist --json returns invalid JSON #3737

Closed
@dionjwa

Description

@dionjwa

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

npm search module_does_not_exist --json

returns invalid JSON

Expected Behavior

npm search module_does_not_exist --json

should valid JSON: []

Steps To Reproduce

npm i -g [email protected]
npm search lodash --json

Outputs valid JSON

npm i -g [email protected]
npm search lodash_does_not_exist --json

Outputs just ]
which is not valid json so e.g. npm search lodash_does_not_exist --json | jq fails.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions