Skip to content

[BUG] Inconsisitent output from npm pkg get #6705

@RimashMohomed

Description

@RimashMohomed

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

output of the npm pkg get command with single key is different than the command with multiple key.

When the command executed with one key, Output is as below ie: npm pkg get name -w worksapceA

 "@myScope/workspaceA"
{
  "@myScope/workspaceA": "@myScope/workspaceA"
}

while the command executed with two keys, Output is as below ie: npm pkg get name version -w workspaceA

 {
  "name": "@myScope/workspaceA",
  "version": "2.0.53"
}
{
  "@myScope/workspaceA": {
    "name": "@myScope/workspaceA",
    "version": "2.0.53"
  }
}

Expected Behavior

Below is expected regardless of the key count provided to the command.

with one key

{
  "@myScope/workspaceA": {
    "name": "@myScope/workspaceA"
}

while two keys

{
  "@myScope/workspaceA": {
    "name": "@myScope/workspaceA",
    "version": "2.0.53"
  }
}

Steps To Reproduce

In Windows subsystem for Linux 22.04 with npm version 9 run npm pkg get name -w workspaceA which returns the output inconsistent with the command npm pkg get name version -w workspaceA

Environment

  • npm: 9.6.7
  • Node.js: 18.17.0
  • OS Name: Ubuntu ( 22.04, jammy) on Microsoft Windows 11 Home Single Language
  • System Model Name: HP ProBook 440 G8 Notebook PC
  • npm config:
;  "project" config from /mnt/d/<path to project>/.npmrc

@<variant name>::registry = "https://<company name>.jfrog.io/artifactory/api/npm/npm-local/"
@<company name>:registry = "https://yaala.jfrog.io/artifactory/api/npm/npm-local/"
//<company name>.jfrog.io/artifactory/api/npm/npm-local/:_password = (protected)
//<company name>.jfrog.io/artifactory/api/npm/npm-local/:always-auth = true
//<company name>.jfrog.io/artifactory/api/npm/npm-local/:email = "ci@<company name>.com"
//<company name>.jfrog.io/artifactory/api/npm/npm-local/:username = "cipull"

; node bin location = /<working dir>/.nvm/versions/node/v18.17.0/bin/node
; node version = v18.17.0
; npm local prefix = /<working dir>/<project>
; npm version = 9.6.7
; cwd = <working dir>/<project>
; HOME =  /<working dir>
; 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions