cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Aliased packages ignored by `npm list`

Open jacob418 opened this issue 2 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

npm list [pkg] list only packages that have name = pkg but not packages with alias = pkg

Example:

$ npm list uuid         
[email protected] /path/to/my/project
├─┬ @vue/[email protected]
│ └─┬ @vue/[email protected]
│   └─┬ [email protected]
│     └── [email protected]
├─┬ @vue/[email protected]
│ └─┬ [email protected]
│   └─┬ [email protected]
│     └── [email protected]
├─┬ @vue/[email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected]
│ └─┬ [email protected]
│   └─┬ [email protected]
│     └── [email protected]
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected]

Expected Behavior

I would expect the command to also list installations of the package with name = pkg where alias != pkg, indicating, it has been aliased on the entry of the package tree.

Example:

$ npm list uuid         
[email protected] /path/to/my/project
├─┬ @vue/[email protected]
│ └─┬ @vue/[email protected]
│   └─┬ [email protected]
│     └── [email protected]
├─┬ @vue/[email protected]
│ └─┬ [email protected]
│   └─┬ [email protected]
│     └── [email protected]
├─┬ @vue/[email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected]
│ └─┬ [email protected]
│   └─┬ [email protected]
│     └── [email protected]
├─┬ [email protected]
│ └─┬ [email protected]
│   └── [email protected]
└── [email protected] as uuid8

Notice the last line (new):

└── [email protected] as uuid8

*the part as uuid8 indicates the alias and is only a suggestion, it might look completely different.

Steps To Reproduce

  1. Create VUE-CLI project
  2. Install the uuid package with alias (npm install uuid8@npm:uuid@8)
  3. Run npm list uuid
  4. => The version 8 installation of uuid is not showing up

Environment

  • OS: Linux 5.4.0-81 (Regolit/Ubuntu)
  • Node: 14.17.6
  • npm: 7.24.2

jacob418 avatar Oct 05 '21 09:10 jacob418

Me too, and what's the plan to this issue?

cjz9032 avatar Jul 29 '22 06:07 cjz9032