Skip to content

[BUG] npm view returning string without quotes with version 10.8.0 #7537

Closed
@byCedric

Description

@byCedric

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 using npm view <package> <selector> --json, I expect only to receive JSON data types. Unfortunately, for [email protected] that's not the case anymore.

Running npm view expo-template-bare-minimum@sdk-51 dist.tarball --json now yields the tarball string, without quotes, making it not a JSON result anymore.

image

Expected Behavior

When using this same command with [email protected], the response is wrapped in quotes, making it a valid JSON response (or at least parsable through JSON.parse(...).

image

Steps To Reproduce

Result that's not parsable with JSON.parse:

  1. $ npm i -g [email protected]
  2. $ npm -v → Should return 10.8.0
  3. $ npm view expo-template-bare-minimum@sdk-51 dist.tarball --json
    → Should return https://... (without quotes)

Result that is parsable with JSON.parse:

  1. $ npm i -g [email protected]
  2. $ npm -v → Should return 10.7.0
  3. $ npm view expo-template-bare-minimum@sdk-51 dist.tarball --json
    → Should return "https://..." (with quotes)

Environment

  • npm: 10.8.0
  • Node.js: 22.2.0
  • OS Name: macOS Sanoma 14.4.1
  • System Model Name: MacBook Pro (14" 2023)
  • npm config:
; "user" config from /Users/cedric/.npmrc

//registry.npmjs.org/:_authToken = (protected)
store-dir = "/Users/cedric/.pnpm"

; node bin location = /Users/cedric/.nvm/versions/node/v22.2.0/bin/node
; node version = v22.2.0
; npm local prefix = /Users/cedric/Desktop
; npm version = 10.8.0
; cwd = /Users/cedric/Desktop
; HOME = /Users/cedric
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions