-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
returning string without quotes with version 10.8.0
#7537
Labels
Comments
byCedric
added
Bug
thing that needs fixing
Needs Triage
needs review for next steps
labels
May 16, 2024
This was referenced May 16, 2024
Closed
byCedric
added a commit
to expo/expo
that referenced
this issue
May 16, 2024
# Why Fixes #28916 # How Instead of relying on the (escaped) quotes to be included in `npm view` output, this just parses the full object instead. Unfortunately, this seems to be caused by npm 10.8.0. Starting from this version, the output of `npm view <package> dist.tarball --json` is not wrapped in quotes anymore, meaning that the value is not a JSON value anymore (and can't be parsed by `JSON.parse`). See: npm/cli#7537 # Test Plan See prebuild e2e # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [x] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
I introduced this in #7513. Will have a PR to fix it shortly. |
lukekarrys
added a commit
that referenced
this issue
May 16, 2024
In refactoring this behavior previously plain strings were no longer being passed through JSON.stringify even in json mode. This commit changes that to the previous behavior which fixes the bug in `npm view`. This also required changing the behavior of `npm pkg` which relied on this. Fixes #7537
lukekarrys
added a commit
that referenced
this issue
May 17, 2024
In refactoring this behavior previously plain strings were no longer being passed through JSON.stringify even in json mode. This commit changes that to the previous behavior which fixes the bug in `npm view`. This also required changing the behavior of `npm pkg` which relied on this. Fixes #7537
lukekarrys
added a commit
that referenced
this issue
May 17, 2024
In refactoring this behavior previously plain strings were no longer being passed through JSON.stringify even in json mode. This commit changes that to the previous behavior which fixes the bug in `npm view`. This also required changing the behavior of `npm pkg` which relied on this. Fixes #7537
lukekarrys
added a commit
that referenced
this issue
May 17, 2024
In refactoring this behavior previously plain strings were no longer being passed through JSON.stringify even in json mode. This commit changes that to the previous behavior which fixes the bug in `npm view`. This also required changing the behavior of `npm pkg` which relied on this. Fixes #7537
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
When using
npm view <package> <selector> --json
, I expect only to receive JSON data types. Unfortunately, fornpm@10.8.0
that's not the case anymore.Running
npm view expo-template-bare-minimum@sdk-51 dist.tarball --json
now yields thetarball
string, without quotes, making it not a JSON result anymore.Expected Behavior
When using this same command with
npm@10.7.0
, the response is wrapped in quotes, making it a valid JSON response (or at least parsable throughJSON.parse(...)
.Steps To Reproduce
Result that's not parsable with
JSON.parse
:$ npm i -g npm@10.8.0
$ npm -v
→ Should return10.8.0
$ npm view expo-template-bare-minimum@sdk-51 dist.tarball --json
→ Should return
https://...
(without quotes)Result that is parsable with
JSON.parse
:$ npm i -g npm@10.7.0
$ npm -v
→ Should return10.7.0
$ npm view expo-template-bare-minimum@sdk-51 dist.tarball --json
→ Should return
"https://..."
(with quotes)Environment
The text was updated successfully, but these errors were encountered: