Skip to content

[RRFC] npm explain should work even absent a lockfile and node_modules #523

@ljharb

Description

@ljharb

Motivation ("The Why")

For example, npm/cli#4311 (comment) - when the first (ever, or first locally on a project without a lockfile) install fails, there's no lockfile and no node_modules, and no way to know why something's attempting to be installed.

Arborist has the ability to load the ideal tree in this circumstance, so there's no technical barrier I'm aware of that prevents this command from working.

Example

Solely from a package.json, npm explain foo would work without requiring a lockfile, or reified dependencies.

How

Current Behaviour

When I run npm explain foo without a lockfile or node_modules present, i get npm ERR! No dependencies found matching foo.

Desired Behaviour

I'd expect to get the same result as when either are present - the actual explanation of where foo comes from.

(If this seems like something simple enough to not require an RFC, i'd be happy to make a PR to add it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions