SyntaxError: Unexpected end of JSON input when trying to publish packages
See original GitHub issueAffected Packages
All of the packages
Problem
When I try to publish my packages using pnpx changesets publish
I get this error:
➜ pnpx changeset publish
🦋 info npm info @tinyhttp/app
🦋 info npm info @tinyhttp/cors
🦋 info npm info @tinyhttp/etag
🦋 info npm info @tinyhttp/logger
🦋 info npm info @tinyhttp/static
🦋 info @tinyhttp/app is being published because our local version (0.1.21) has not been published on npm
🦋 info @tinyhttp/cors is being published because our local version (0.1.20) has not been published on npm
🦋 info @tinyhttp/etag is being published because our local version (0.1.20) has not been published on npm
🦋 info @tinyhttp/logger is being published because our local version (0.1.20) has not been published on npm
🦋 info @tinyhttp/static is being published because our local version (0.1.20) has not been published on npm
🦋 info Publishing "@tinyhttp/app" at "0.1.21"
🦋 info Publishing "@tinyhttp/cors" at "0.1.20"
🦋 info Publishing "@tinyhttp/etag" at "0.1.20"
🦋 info Publishing "@tinyhttp/logger" at "0.1.20"
🦋 info Publishing "@tinyhttp/static" at "0.1.20"
🦋 error SyntaxError: Unexpected end of JSON input
🦋 error at JSON.parse (<anonymous>)
🦋 error at internalPublish (/home/v1rtl/Coding/tinyhttp/node_modules/.pnpm/@changesets/cli@2.9.1_@types+node@14.0.13/node_modules/@changesets/cli/dist/cli.cjs.dev.js:591:19)
🦋 error at processTicksAndRejections (internal/process/task_queues.js:97:5)
Same happens with ./node_modules/.bin/changeset publish
I don’t know what causes it because there’s no clear error message.
Helpful info
reproduction repository: https://github.com/talentlessguy/tinyhttp
changesets config: https://github.com/talentlessguy/tinyhttp/blob/master/.changeset/config.json
node
version: 14.4.0
pnpm
version: 5.0.2
npm
version: 6.14.5
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:49 (17 by maintainers)
Top Results From Across the Web
SyntaxError: Unexpected end of JSON input when trying to ...
I think the main problem is that changesets assumes that npm publish will always return valid json which is not the case. As...
Read more >Uncaught SyntaxError: Unexpected end of JSON input
A common error encountered by JavaScript programmers is the Uncaught SyntaxError: Unexpected end of JSON input. This is usually observed when the coder...
Read more >Unexpected end of JSON input error when creating new project
1 Answer 1 · Install Node Version Manager (or NVM for Windows) and install Node version 10.16. · Uninstall global angular package npm...
Read more >How to fix "SyntaxError: Unexpected token < in JSON at ...
This error occurs when you are trying to parse a string to JSON and the string is not parsable. In other words, it...
Read more >Fix the unexpected end of input error in JavaScript - Codedamn
One common cause of unexpected end of JSON input error is simply that the JSON data is not well-formed. This means that there...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, already pushed out a change like this a couple of hours ago 😉 :
https://github.com/atlassian/changesets/commit/89a70f9d6702740c8b4c7903faefb8c7286bff20
Need to self-review and retest this before publishing a PR.
Thank you also for other comments - i will take a deeper look into everything you have mentioned
For me, I had to add the following to my package.json’s:
Answer from: https://stackoverflow.com/a/53478078