You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SvelteKit Vite开发服务器打开页面时出现Rollup语法错误求助

SvelteKit Vite开发服务器打开页面时出现Rollup语法错误求助

嘿,各位开发者朋友,我最近碰到个头疼的问题,想请大家帮忙诊断一下!

我在运行SvelteKit项目的Vite开发服务器时,执行npm run dev启动服务一切看似正常,但当我试图打开页面的时候,直接弹出了Rollup语法错误,具体报错信息如下:

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)

另外浏览器里也显示了对应的错误界面,能看到是语法解析时遇到了意外的逗号,预期应该是标识符或者字符串。

我已经初步检查了当前页面关联的Svelte组件代码,比如对象、数组、函数参数这些容易多打逗号的地方,但暂时没发现问题。有没有朋友遇到过类似的情况?或者能给我一些排查的方向呀?比如是不是依赖版本的问题?或者某个配置项没设置对?

备注:内容来源于stack exchange,提问作者Mikko Ohtamaa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 10:09:42