Skip to content

[BUG] npm ls --all --production --parseable output differs between npm 10 and npm 11 #8692

@XL-Zhao-23

Description

@XL-Zhao-23

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

翻译如下:


When I run npm ls --all --production --parseable on Node.js 20 and Node.js 24, the outputs are inconsistent. For multi-platform optional dependencies, npm v10.8.2 corresponding to Node.js v20 only lists the packages for the current platform, while npm v11.6.1 corresponding to Node.js v24 lists all platform variants. This behavior does not match the expected semantics of the ls command.

Specifically, npm v10.8.2 outputs:

/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/process-nextick-args
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/safe-buffer
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/string_decoder
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/util-deprecate
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-x64-glibc
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-x64-musl
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/detect-libc
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/is-glob
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/micromatch

npm v11.6.1 outputs:

/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/process-nextick-args
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/safe-buffer
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/string_decoder
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/util-deprecate
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-android-arm64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-darwin-arm64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-darwin-x64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-freebsd-x64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-arm-glibc
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-arm-musl
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-arm64-glibc
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-arm64-musl
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-x64-glibc
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-x64-musl
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-win32-arm64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-win32-ia32
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-win32-x64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/detect-libc
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/is-glob
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/micromatch

Expected Behavior

I expect npm v10.8.2 and npm v11.6.1 to produce consistent output, in accordance with the semantics of this command: only display the packages that are actually installed.

Steps To Reproduce

  1. git clone https://github.com/apache/skywalking-banyandb.git
  2. cd ./skywalking-banyandb/ui
  3. nvm use 24 4. npm ls --all --production --parseable
  4. nvm use 20.12.0 6. npm ls --all --production --parseable
  5. Comparing the outputs, you can see that the former lists multiple platform-specific package variants:
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-android-arm64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-darwin-arm64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-darwin-x64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-freebsd-x64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-arm-glibc
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-arm-musl
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-arm64-glibc
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-arm64-musl
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-x64-glibc
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-linux-x64-musl
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-win32-arm64
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-win32-ia32
/home/zxl/GoProjects/skywalking-banyandb/ui/node_modules/@parcel/watcher-win32-x64

Environment

  • npm: v11.6.1
  • Node.js: v24
  • OS Name: Ubantu 22.04
  • System Model Name: HP ZHAN 66

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions