forcedotcom / lwc-dev-server-feedback

LWC Local Development
BSD 3-Clause "New" or "Revised" License
45 stars 10 forks source link

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

Open JNiedle opened 2 years ago

JNiedle commented 2 years ago

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):

Additional context Add any other context about the problem here.

stale[bot] commented 2 years ago

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

stale[bot] commented 1 year ago

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