所以昨天我正在做一个项目,当我准备退出时,因为我已经完成了它,我得到了这个错误,并且今天一整天都在尝试修复它。我的代码可以工作,然后就崩溃了,将所有内容都取消到我知道它可以工作的程度,但它仍然被破坏了。
我在 browserConsole 中收到的错误是:
GET http://localhost:8080/src/js/component/App.vue net::ERR_ABORTED 500(内部服务器错误)(main.js:5)
当我查看 main.js 第 5 行时,只有 App 的导入。自从项目开始以来我就没有接触过 main.js、App.vue 和 AppTemplate.vue,因为我没有必要这样做。
要运行我的代码,我在终端中使用 run vite (或者在我的情况下是 phpstorm 中运行窗口的快捷方式),我收到另一个错误:
Cannot read properties of undefined (reading 'type') Cannot read properties of undefined (reading 'type') (x2) Cannot read properties of undefined (reading 'type') (x3) Cannot read properties of undefined (reading 'type') (x4) Cannot read properties of undefined (reading 'type') (x5) Cannot read properties of undefined (reading 'type') (x6) Cannot read properties of undefined (reading 'type') (x7) Cannot read properties of undefined (reading 'type') (x8) Cannot read properties of undefined (reading 'type') (x9) Cannot read properties of undefined (reading 'type') (x10) 1:40:13 PM [vite] Internal server error: Codegen node is missing for element/if/for node. Apply appropriate transforms first. Plugin: vite:vue File: /Users/robdewilligen/Development/Wittig/jobse/app/src/js/component/App.vue at assert (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:508:15) at genNode (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2628:13) at genNodeList (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2602:13) at genNodeListAsArray (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2587:5) at genNodeList (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2599:13) at genVNodeCall (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2770:5) at genNode (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2651:13) at generate (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2412:9) at Object.baseCompile (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:5690:12) at Object.compile (/Users/robdewilligen/Development/Wittig/jobse/app/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.js:3100:25) ``` this bit repeats another 6 or 7 times or so: ``` Cannot read properties of undefined (reading 'type') Cannot read properties of undefined (reading 'type') (x2) Cannot read properties of undefined (reading 'type') (x3) Cannot read properties of undefined (reading 'type') (x4) Cannot read properties of undefined (reading 'type') (x5) Codegen node is missing for element/if/for node. Apply appropriate transforms first. Codegen node is missing for element/if/for node. Apply appropriate transforms first. (x2)
到目前为止,我已经尝试了任何我能找到或想到的东西,
从重新启动 vite 开始, 重新启动docker容器, 重新启动我的笔记本电脑, 就像我之前说的,恢复到工作版本但仍然损坏。 更新终端开发工具和 git 抱怨的一些事情。 检查标签是否放置错误。 (没有放错地方)
我不知道该做什么了,非常欢迎任何和所有建议。 任何请求的信息我都会尽力尽快分享。
我有一台 MacBook Pro 2020 将 Vue 3 与 Vite 结合使用 我使用的一些库是: vue 类组件 轴 vue-路由器 vueX
P粉1547981962023-10-27 13:26:47
此模板也出现了这个晦涩的错误:
<template> <AppShell> <template v-slot:header> <template v-slot:home>Home</template> <RouterLink to="/media">Media</RouterLink> </template> </AppShell> </template>
缺少我的 NavBar
组件,而应该是:
<template> <AppShell> <template v-slot:header> <NavBar> <template v-slot:home>Home</template> <RouterLink to="/media">Media</RouterLink> </NavBar> </template> </AppShell> </template>
尝试将模板放入模板显然是行不通的。
我也在 Docker 中进行开发,但在本例中似乎并不相关。
P粉7181655402023-10-27 10:39:24
所以我想通了,好吧,我的设计老板做到了,我所要做的就是删除node_modules目录并运行npm install来重新安装该目录。这为我解决了。希望对其他人也能如此。