You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem
One of the most popular use cases for pkg get command is getting values for other scripts as variables. However currently it's returning the value with quotes:
npm pkg get version
"4.12.2"
The current solution is to use it in a pipe and remove quotes somehow with sed or jq. It's ok, but this solution si not cross-platform or requires additional packages installation.
Suggestion
To introduce --raw/-r flag for npm pkg get command
Thus, for the following command we will expect the raw value:
Reacted by Remco Tolsma, Robin, Aljoscha Bollmann, Sergei Solovev, Bruno Macedo, Olle Bröms, DarkMikey, Joël DIBASSO, scipilot, Vladyslav Zubko and 15 more
From the linked RFC (npm/rfcs#634), this is a great feature enhancement (and something I would use personally 😄). If anyone wants to implement it, the flag should be --parseable. I'm going to close the linked RFC and use this issue for tracking.
As the default value for the --json flag is false, this can be seen as a bug fix, not a feature and no flag should be necessary (breaking changes, etc, aside).
Activity
ljharb commentedon Sep 14, 2022
Seems reasonable to me - you may want to file an RFC.
ThePlenkov commentedon Sep 15, 2022
@ljharb sure - but I don't know what is this. Do you have an example?
ThePlenkov commentedon Sep 15, 2022
Do you mean I'd better create it here? https://github.com/npm/rfcs/issues
ThePlenkov commentedon Sep 15, 2022
Just did: npm/rfcs#634
lukekarrys commentedon Nov 10, 2022
From the linked RFC (npm/rfcs#634), this is a great feature enhancement (and something I would use personally 😄). If anyone wants to implement it, the flag should be
--parseable. I'm going to close the linked RFC and use this issue for tracking.mbrevda commentedon Nov 24, 2022
As the default value for the
--jsonflag isfalse, this can be seen as a bug fix, not a feature and no flag should be necessary (breaking changes, etc, aside).ThePlenkov commentedon Mar 18, 2023
Hi! I'm really wondering will any of flags ( --raw, --parseable, --json ) be considered to print version without quotes? Thanks!
alasdairhurst commentedon Nov 25, 2025
What would the expectation be for non-string values fetched by
npm pkg get --parseable?For example `npm pkg get dependencies --parseable
wraithgar commentedon Apr 22, 2026
#9269