Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SvelteKit: RollupError: Unexpected token `,`. Expected identifier or string

When I am running SvelteKit vite dev server with npm run dev I am getting error when trying to open a page:

RollupError: Unexpected token `,`. Expected identifier or string
    at getRollupError (file:///Users/moo/code/frentek/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
    at ParseError.initialise (file:///Users/moo/code/frentek/node_modules/rollup/dist/es/shared/node-entry.js:11170:28)
    at convertNode (file:///Users/moo/code/frentek/node_modules/rollup/dist/es/shared/node-entry.js:12915:10)
    at convertProgram (file:///Users/moo/code/frentek/node_modules/rollup/dist/es/shared/node-entry.js:12232:12)
    at Module.setSource (file:///Users/moo/code/frentek/node_modules/rollup/dist/es/shared/node-entry.js:14076:24)
    at async ModuleLoader.addModuleSource (file:///Users/moo/code/frentek/node_modules/rollup/dist/es/shared/node-entry.js:18729:13)

enter image description here

However Vite does not tell where the problem happens.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The same error message is with npm run build without more information.

How can I locate the problematic Svelte file having a parse error?

>Solution :

You should be able to attach a debugger at the location the error occurs.
How this is best done depends on IDE, for VS Code, e.g. see these docs.

When execution is halted you can navigate the stack and search for the location the source code is passed into the pipeline. If you have the relevant source, identifying the component should not be that hard.

If you want more specific advice, provide a minimal reproduction.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading