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
Ran into an issue while running the following command with hnvm:
> npx browserslist@latest --update-db
SyntaxError: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at getLatestInfo (/Users/philipting/dev/modus-web/platform/node_modules/browserslist/update-db.js:51:15)
at updateDB (/Users/philipting/dev/modus-web/platform/node_modules/browserslist/update-db.js:202:16)
at Object.<anonymous> (/Users/philipting/dev/modus-web/platform/node_modules/browserslist/cli.js:40:3)
The reason for this is because browserslist is using npm view with a --json flag to generate JSON output, but hnvm adds version information to the output.
I was able to fix this issue by adding HNVM_QUIET to my .hnvmrc. However, I feel this to be a workaround, rather than a proper fix. I had to dig into node_modules and dump the output into a separate file before discovering that the JSON output was incorrect because of the extra output generated by hnvm.
I feel that regardless of the HNVM_QUIET flag, any npm commands that output JSON should never have version information printed on the top. It causes JSON objects to be invalid.
Quick glance through npm commands tells me the following commands have a JSON flag.
npm audit
npm config
npm explain
npm fund
npm org
npm outdated
npm pack
npm pkg
npm profile
npm prune
npm search
npm team
npm version
npm view
The text was updated successfully, but these errors were encountered:
Ran into an issue while running the following command with hnvm:
The reason for this is because
browserslist
is usingnpm view
with a--json
flag to generate JSON output, but hnvm adds version information to the output.I was able to fix this issue by adding
HNVM_QUIET
to my.hnvmrc
. However, I feel this to be a workaround, rather than a proper fix. I had to dig intonode_modules
and dump the output into a separate file before discovering that the JSON output was incorrect because of the extra output generated by hnvm.I feel that regardless of the
HNVM_QUIET
flag, anynpm
commands that output JSON should never have version information printed on the top. It causes JSON objects to be invalid.Quick glance through npm commands tells me the following commands have a JSON flag.
The text was updated successfully, but these errors were encountered: