Skip to content
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

🐛 Fix #600: Unexpected end of json input #645

Merged
merged 2 commits into from
Jun 22, 2022
Merged

🐛 Fix #600: Unexpected end of json input #645

merged 2 commits into from
Jun 22, 2022

Conversation

trickypr
Copy link
Contributor

@trickypr trickypr commented Jun 20, 2022

NPM is mixing json with human readable error messages (npm/cli#2740)
and refuse to fix it because they want more time to plan (npm/cli#3437).
This provides a temporary fix by simply filtering out every line that starts
with npm ERR! so we have a clean JSON input.

As a side effect, this will be broken when attaching a debugger to the
process, but that would have been broken without this fix.

Note: I have not added a test, but I can try if you find that they are necessary.

Fixes #600

NPM is mixing json with human readable error messages (npm/cli#2740)
and refuse to fix it because they want more time to plan (npm/cli#3437).
This provides a temporary fix by simply filtering out every line that starts
with `npm ERR!` so we have a clean JSON input.

As a side effect, this will be broken when attaching a debugger to the
process, but that would have been broken without this fix.
@sindresorhus
Copy link
Owner

CI is failing

@trickypr
Copy link
Contributor Author

That should fix it

@201flaviosilva
Copy link

I'm getting this error too, there 😅: https://gitlab.com/201flaviosilva/utilsjs

@sindresorhus sindresorhus merged commit 6c871f9 into sindresorhus:main Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected end of JSON input
3 participants