vue3+ts+vite堆栈溢出报错?

报错信息
events.js:377

  throw er; // Unhandled 'error' event
  ^

RangeError [Error]: Maximum call stack size exceeded

at String.replace (<anonymous>)
at toFileNameLowerCase (D:\htht\10004\sea-scenario-configuration\node_modules\typescript\lib\tsserverlibrary.js:1786:15)
at Object.toPath (D:\htht\10004\sea-scenario-configuration\node_modules\typescript\lib\tsserverlibrary.js:8041:16)
at Object.getOrCreateSourceFile (D:\htht\10004\sea-scenario-configuration\node_modules\typescript\lib\tsserverlibrary.js:169394:65)
at D:\htht\10004\sea-scenario-configuration\node_modules\typescript\lib\tsserverlibrary.js:169304:51
at Object.getSourceFileWithCache [as getSourceFile] (D:\htht\10004\sea-scenario-configuration\node_modules\typescript\lib\tsserverlibrary.js:118621:30)   
at findSourceFileWorker (D:\htht\10004\sea-scenario-configuration\node_modules\typescript\lib\tsserverlibrary.js:121034:29)
at findSourceFile (D:\htht\10004\sea-scenario-configuration\node_modules\typescript\lib\tsserverlibrary.js:120931:26)
at processImportedModules (D:\htht\10004\sea-scenario-configuration\node_modules\typescript\lib\tsserverlibrary.js:121340:25)
at findSourceFileWorker (D:\htht\10004\sea-scenario-configuration\node_modules\typescript\lib\tsserverlibrary.js:121085:17)

Emitted 'error' event on process instance at:

at emitUnhandledRejectionOrErr (internal/event_target.js:579:11)
at MessagePort.[nodejs.internal.kHybridDispatch] (internal/event_target.js:403:9)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:18:26)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sea-wind-power@1.0.0 dev: vite --host 0.0.0.0
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sea-wind-power@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! D:\Program Files\nodejs\node_cache\_logs\2023-11-22T07_00_22_678Z-debug.log

有大佬知道这是为什么会导致的堆栈溢出报错吗?(vite + ts的项目)

希望解决

大概有个方向,可能是本地运行时[vite] hmr update导致的内存溢出

阅读 821
2 个回答

铁子,死循环了或者无限递归或者UI组件无限刷新了。
检查下报错文件所在位置处理了什么逻辑:
image.png

一般来说是某处代码或者配置有问题导致的。

这个时候错误提示已经没什么用了,因为距离现场太远。能采用的办法有二:

  1. 从上次能跑的位置开始检查,逐步添加新代码,直到确定出问题的代码
  2. 从最小能跑的环境开始检查,逐步添加代码,直到确定出问题的代码
推荐问题
logo
Microsoft
子站问答
访问
宣传栏