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

Dev Server Fails to Start w/ error "SyntaxError: Unexpected end of JSON input" #134

Open
JNiedle opened this issue Apr 27, 2022 · 2 comments

Comments

@JNiedle
Copy link

JNiedle commented Apr 27, 2022

Describe the bug
When starting the LWC dev server, an error is displayed "SyntaxError: Unexpected end of JSON input" and a message that the dev server is unable to start.

I was able to resolve the bug by searching within the SFDX project for empty (0 kb) JSON files. I found one file matching this criteria at {projectLocation}/.localdevserver/metadata.json. After updating that file with {}, the server was able to start.

Stack trace:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at getLatestVersion (C:\Users\{username}\AppData\Local\sfdx\node_modules\@webruntime\services\dist\commonjs\utils.js:37:49)
    at Object.getLatestCachedResourceMap (C:\Users\{username}\AppData\Local\sfdx\node_modules\@webruntime\services\dist\commonjs\utils.js:27:21)
    at ImportMapService.updateUIDMap (C:\Users\{username}\AppData\Local\sfdx\node_modules\@webruntime\services\dist\commonjs\importmap-service.js:44:35)
    at ImportMapService.initialize (C:\Users\{username}\AppData\Local\sfdx\node_modules\@webruntime\services\dist\commonjs\importmap-service.js:55:14)
    at Container.initializeService (C:\Users\{username}\AppData\Local\sfdx\node_modules\@webruntime\server\dist\commonjs\container\container.js:94:27)
    at Container.initialize (C:\Users\{username}\AppData\Local\sfdx\node_modules\@webruntime\server\dist\commonjs\container\container.js:81:25)
    at Container.descriptor.value (C:\Users\{username}\AppData\Local\sfdx\node_modules\@webruntime\performance\dist\commonjs\performance-timing.js:52:34)
    at Server.initialize (C:\Users\{username}\AppData\Local\sfdx\node_modules\@webruntime\server\dist\commonjs\server\server.js:57:34)
    at Server.descriptor.value (C:\Users\{username}\AppData\Local\sfdx\node_modules\@webruntime\performance\dist\commonjs\performance-timing.js:52:34)

To Reproduce
Steps to reproduce the behavior:
Unknown

Expected behavior
The code that is looking at the contents of this file should be validating if the text in this file is a blank value. If it is, it should assume the value is "{}"

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
  • Version: 100.0.4896.127 (64-Bit)

Additional context
Add any other context about the problem here.

@stale
Copy link

stale bot commented Jun 4, 2022

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

@stale stale bot added the type:bug-p3 label Jun 4, 2022
@stale stale bot removed the type:bug-p3 label Jul 28, 2022
@stale
Copy link

stale bot commented Aug 12, 2022

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

@stale stale bot added the type:bug-p3 label Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant