GeezerVison is showing github.com — [BUG] npm ls command listing EXTRANEOUS package for clean install · Issue #8832 · npm/cli
[BUG] npm ls command listing EXTRANEOUS package for clean install #8832DescriptionIs 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
The npm lscommand lists an EXTRANEOUS package, that doesn't appear to be removable.
Not sure if it's an upstream package dependency problem, mind.
Expected Behavior
No EXTRANEOUS package.
Steps To Reproduce
With package.json:
{
"name": "test",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint ."
},
"dependencies": {
"@tanstack/react-query": "^5.90.12",
"@uidotdev/usehooks": "^2.4.1",
"axios": "^1.13.2",
"bootstrap": "^5.3.8",
"next": "^16.0.7",
"next-auth": "^5.0.0-beta.27",
"react": "^19.2.1",
"react-bootstrap": "^2.10.10",
"sharp": "^0.34.5",
"zod": "^4.1.13"
},
"devDependencies": {
"@types/node": "^24.10.1",
"baseline-browser-mapping": "^2.9.2",
"eslint": "^9.39.1",
"eslint-config-next": "^16.0.7",
"typescript": "^5.9.3"
}
}
Steps:
$ rm -rf node_modules/ package-lock.json
$ npm i
...
$ npm ls --all --parseable --long --omit=dev --omit=optional | grep EXT
.../npm_test/node_modules/@emnapi/runtime:@emnapi/[email protected]:EXTRANEOUS
Environment
$ uname -ra
Linux <hostname> 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64 GNU/Linux
$ npm config ls
; node bin location = .../.nvm/versions/node/v22.14.0/bin/node
; node version = v22.14.0
; npm local prefix = .../npm_test
; npm version = 11.6.4
; cwd = .../npm_test
; HOME = ...
; Run `npm config ls -l` to show all defaults. Reacted by jesvinjames, koooge and Lovell Fuller Activityjesvinjames commented on Jan 11, 2026 This issue can be reproduced with just unrs-resolver and sharp. Both have optional dependencies that depends on @emnapi/runtime.
@emnapi/runtime is installed although their parent optional dependencies @unrs/resolver-binding-wasm32-wasi and @img/sharp-wasm32 are not installed as they do not meet the system requirements. Only @emnapi/runtime and tslib are installed erroneously. Other dependencies of optional dependencies are not installed as expected.
Minimum reproduction
package-lock.json in case transitive dependencies change.
Dependency graph of unrs-resolver including optional dependencies
Dependency graph of sharp including optional dependencies
npm ls --all output
Installed packages
node_modules/@unrs/resolver-binding-linux-x64-gnu
node_modules/@img/colour
node_modules/@img/sharp-libvips-linux-x64
node_modules/@img/sharp-linux-x64
node_modules/@emnapi/runtime
node_modules/unrs-resolver
node_modules/detect-libc
node_modules/semver
node_modules/tslib
node_modules/napi-postinstall
node_modules/sharp
npm config ls output
; node bin location = /usr/local/bin/node
; node version = v24.8.0
; npm local prefix = /npm-extraneous
; npm version = 11.7.0
; cwd = /npm-extraneous
; HOME = /root
; Run `npm config ls -l` to show all defaults.
lovell commented on Apr 5, 2026 Advance warning for npm maintainers: this issue is likely to become more prevalent as it appears to affect the next version of sharp without any other dependencies involved.
Here's a quick way to reproduce using only the latest v0.35.0-rc.2 release candidate:
In this example on the linux-x64 platform, the dependencies marked "UNMET OPTIONAL" are correctly not installed but the dependencies marked "extraneous" are incorrectly installed.
If there's something that sharp is doing wrong then please let me know and I'll fix it. lovell commented on Apr 13, 2026 I've opened a PR with a possible fix for this at #9221
(As an aside, I think this issue might have been exposed due to the change in #8537.)
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|