Skip to content

[BUG] npm query *:missing only return the first missing dependency #7316

@dmnsgn

Description

@dmnsgn

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

npm query *:missing only return one item when no dependency are installed (for package.json with 2 dependencies and 2 devDependencies).

No luck with any combination of selector (.dev,.prod) or pseudo-selector (:root, :scope).

Expected Behavior

I expect all "dependencies not found on disk" to be returned.

Steps To Reproduce

mkd my-package
npm init -y
npm i canvas-context canvas-tint-image
npm i -D glob
rm -r node_modules
npm query '*:missing'

// returns
[
  {
    "name": "canvas-context",
    "version": "^3.2.0",
    "_id": "canvas-context@^3.2.0",
    "pkgid": "canvas-context@^3.2.0",
    "path": null,
    "realpath": null,
    "resolved": null,
    "from": [],
    "to": [],
    "dev": true,
    "inBundle": false,
    "deduped": false,
    "overridden": false,
    "queryContext": {}
  }
]

Only the first missing package removed from node_modules is returned.

Environment

  • npm: 10.5.0
  • Node.js: v21.7.1
  • OS Name: MacOS

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions