Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Npm view command issue when private registry return manifest short version #8132

Open
2 tasks done
aleDVirgo opened this issue Feb 25, 2025 · 3 comments
Open
2 tasks done
Labels
Bug thing that needs fixing config:private-registry

Comments

@aleDVirgo
Copy link

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

We noticed that from npm version 11 we have issue with the view command, the code referenced below doesn't check for time existence property in the manifest output.

const aTime = aTag === 'latest' ? Infinity : Date.parse(packu.time[aVer])

However the time property doesn't exist if the manifest is in the short version, resulting in a null pointer (variable is undefined). Downgrading to latest v10 solves the issue

Expected Behavior

It should print package info

Steps To Reproduce

  1. Setup a private registry
  2. Run npm show or npm view of a package with the private scope

Environment

  • npm: 11.1.0
  • Node.js: 23.8.0
  • OS Name: Arch Linux
  • System Model Name: Dell latitude
  • npm config:
; copy and paste output from `npm config ls` here
; "user" config from /home/ale/.npmrc

@middleware:registry = "https://gitlab.dvtech.io/api/v4/projects/3928/packages/npm/"
//gitlab.dvtech.io/api/v4/projects/3928/packages/npm/:_authToken = (protected)

; "env" config from environment

prefix = "/home/ale/.local"

; node bin location = /usr/bin/node
; node version = v23.8.0
; npm local prefix = /home/ale
; npm version = 11.1.0
; cwd = /home/ale
; HOME = /home/ale
@aleDVirgo aleDVirgo added Bug thing that needs fixing Needs Triage needs review for next steps labels Feb 25, 2025
@milaninfy
Copy link
Contributor

Could you please provide what npm view some-test-package output shows with logs using --verbose ?

@aleDVirgo
Copy link
Author

npm show @middleware/su-baseclient --verbose
npm verbose cli /home/zingo/.nvm/versions/node/v22.12.0/bin/node /home/zingo/.nvm/versions/node/v22.12.0/bin/npm
npm info using npm@11.0.0
npm info using node@v23.8.0
npm verbose title npm show @middleware/su-baseclient
npm verbose argv "show" "@middleware/su-baseclient" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:/home/zingo/.npm/_logs/2025-02-25T16_28_27_299Z-
npm verbose logfile /home/zingo/.npm/_logs/2025-02-25T16_28_27_299Z-debug-0.log
npm http fetch GET 200 https://gitlab.dvtech.io/api/v4/projects/3928/packages/npm/@middleware%2fsu-baseclient 378ms (cache revalidated)
npm verbose stack TypeError: Cannot read properties of undefined (reading '3.0.0-SNAPSHOT.473402')
npm verbose stack     at /home/zingo/.nvm/versions/node/v22.12.0/lib/node_modules/npm/lib/commands/view.js:272:75
npm verbose stack     at Array.sort (<anonymous>)
npm verbose stack     at #prettyView (/home/zingo/.nvm/versions/node/v22.12.0/lib/node_modules/npm/lib/commands/view.js:271:8)
npm verbose stack     at #viewPackage (/home/zingo/.nvm/versions/node/v22.12.0/lib/node_modules/npm/lib/commands/view.js:117:41)
npm verbose stack     at async View.exec (/home/zingo/.nvm/versions/node/v22.12.0/lib/node_modules/npm/lib/commands/view.js:70:5)
npm verbose stack     at async Npm.exec (/home/zingo/.nvm/versions/node/v22.12.0/lib/node_modules/npm/lib/npm.js:207:9)
npm verbose stack     at async module.exports (/home/zingo/.nvm/versions/node/v22.12.0/lib/node_modules/npm/lib/cli/entry.js:69:5)
npm error Cannot read properties of undefined (reading '3.0.0-SNAPSHOT.473402')
npm verbose cwd /home/zingo
npm verbose os Linux 6.11.0-17-generic
npm verbose node v23.8.0
npm verbose npm  v11.0.0
npm verbose exit 1
npm verbose code 1
npm error A complete log of this run can be found in: /home/zingo/.npm/_logs/2025-02-25T16_28_27_299Z-debug-0.log

@Delagen
Copy link

Delagen commented Mar 5, 2025

The same issue with Gitlab. NPM 10 works fine.

@milaninfy milaninfy removed the Needs Triage needs review for next steps label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing config:private-registry
Projects
None yet
Development

No branches or pull requests

4 participants