[BUG] Npm Search is failing on version 10.6.0 - Cannot read properties of undefined (reading 'username')
dorsJfrog opened this issue · comments
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
Im using a custom registry and when i'm running Npm Search command, the client is throwing the following error:
npm verbose logfile logs-max:10 dir:/root/.npm/_logs/2024-04-30T06_23_47_384Z-
npm verbose logfile /root/.npm/_logs/2024-04-30T06_23_47_384Z-debug-0.log
npm verbose stack TypeError: Cannot read properties of undefined (reading 'username')
npm verbose stack at TextOutputStream.write (/usr/lib/node_modules/npm/lib/utils/format-search-stream.js:98:39)
npm verbose stack at [emitData] (/usr/lib/node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass/index.js:490:18)
npm verbose stack at JSONStream.emit (/usr/lib/node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass/index.js:456:25)
npm verbose stack at JSONStream.write (/usr/lib/node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass/index.js:191:14)
npm verbose stack at [_onValue] (/usr/lib/node_modules/npm/node_modules/minipass-json-stream/index.js:173:15)
npm verbose stack at JSONStream.parser.onValue (/usr/lib/node_modules/npm/node_modules/minipass-json-stream/index.js:48:45)
npm verbose stack at proto.emit (/usr/lib/node_modules/npm/node_modules/jsonparse/jsonparse.js:337:8)
npm verbose stack at proto.pop (/usr/lib/node_modules/npm/node_modules/jsonparse/jsonparse.js:332:8)
npm verbose stack at proto.onToken (/usr/lib/node_modules/npm/node_modules/jsonparse/jsonparse.js:402:12)
npm verbose stack at [_onToken] (/usr/lib/node_modules/npm/node_modules/minipass-json-stream/index.js:93:28)
npm verbose cwd /colors-100.100.100
npm verbose Linux 6.6.14-0-virt
npm verbose node v20.12.2
npm verbose npm v10.6.0
npm error Cannot read properties of undefined (reading 'username')
npm verbose exit 1
npm verbose code 1
according to the stacktrace it is failing on format-search-stream.js:98 :
6868abc#diff-4bc15933c685fc9a9ce8be0c13a2f067f5e2b3334bacd6664bdfa7ddc46aedb6R98
publisher: strip(data.publisher.username),
publisher field is new. i didn't found any official DOCS about it and there is no default value.
it's an unexpected and not documented breaking changes
in the code lines 5-17 in the above file, the example json is:
// This module consumes package data in the following format:
//
// {
// name: String,
// description: String,
// maintainers: [{ username: String, email: String }],
// keywords: String | [String],
// version: String,
// date: Date // can be null,
// }
//
// The returned stream will format this package data
// into a byte stream of formatted, displayable output.
someone can take a look and assist?
Expected Behavior
While running Npm Search, the client will return the package.
this issue is started to appears from npm version 10.6.0.
Steps To Reproduce
- In this environment...
- With this config...
- Run '...'
- See error...
Environment
- npm:
- Node.js:
- OS Name:
- System Model Name:
- npm config:
; copy and paste output from `npm config ls` here
Can't reproduce w/ the steps given.
@wraithgar
you probably used npmjs. try to use another registry.
Im using jfrog artifactory.
I'm using a custom registry
Ah your custom registry returns a different search payload than the npm registry. We'll have to default that to "unknown"