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