kingwrcy / discussion

极简论坛
https://discussion.mblog.club
156 stars 17 forks source link

很不幸,本地环境启动报错,请看一下是什么问题呀。 #11

Closed tech1024 closed 1 month ago

tech1024 commented 1 month ago

node v18.20.3 pgsql v14

报错如下:

 ERROR  [nuxt] [request error] [unhandled] [500] 
Invalid prisma.sysConfig.findFirst() invocation in
/opt/discussion/server/api/config.ts:4:1

  1 import fs from "fs";
  2 
  3 export default defineEventHandler(async (event) => {
→ 4   const config = await prisma.sysConfig.findFirst(
The table public.SysConfig does not exist in the current database.
  at In.handleRequestError (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:122:6877)  
  at In.handleAndLogRequestError (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:122:6211)  
  at In.request (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:122:5919)  
  at async l (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:127:11167)  
  at Object.handler (./server/api/config.ts:4:1)  
  at async ./node_modules/h3/dist/index.mjs:1962:19  
  at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)  
  at async toNodeHandle (./node_modules/h3/dist/index.mjs:2249:7)  
  at async ufetch (./node_modules/unenv/runtime/fetch/index.mjs:9:17)  
  at async $fetchRaw2 (./node_modules/ofetch/dist/shared/ofetch.37386b05.mjs:222:26)

 ERROR  [nuxt] [request error] [unhandled] [500] 
Invalid prisma.post.findMany() invocation in
/opt/discussion/server/api/post/list.post.ts:52:1

  49   lastCommentUser: true,
  50 };
  51 
→ 52 let pinnedPost = await prisma.post.findMany(
The table public.Post does not exist in the current database.
  at In.handleRequestError (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:122:6877)  
  at In.handleAndLogRequestError (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:122:6211)  
  at In.request (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:122:5919)  
  at async l (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:127:11167)  
  at Object.handler (./server/api/post/list.post.ts:52:1)  
  at async ./node_modules/h3/dist/index.mjs:1962:19  
  at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)  
  at async toNodeHandle (./node_modules/h3/dist/index.mjs:2249:7)  
  at async ufetch (./node_modules/unenv/runtime/fetch/index.mjs:9:17)  
  at async $fetchRaw2 (./node_modules/ofetch/dist/shared/ofetch.37386b05.mjs:222:26)

 ERROR  [nitro] [unhandledRejection] Cannot read properties of undefined (reading 'length')

  at pages/index.vue:165:29
  at renderFnWithContext (node_modules/.pnpm/@vue+runtime-core@3.4.27/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:825:13)
  at Module.renderSlot (node_modules/.pnpm/@vue+runtime-core@3.4.27/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:2969:53)
  at node_modules/.pnpm/@nuxt+ui@2.16.0_focus-trap@7.5.4_nuxt@3.11.2_@opentelemetry+api@1.8.0_@parcel+watcher@2.4.1_@_fv4tt6ap5ofvze44igakxxao7u/node_modules/@nuxt/ui/dist/runtime/components/layout/Card.vue:111:39
  at renderFnWithContext (node_modules/.pnpm/@vue+runtime-core@3.4.27/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:825:13)
  at normalizeChildren (node_modules/.pnpm/@vue+runtime-core@3.4.27/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7320:34)
  at createBaseVNode (node_modules/.pnpm/@vue+runtime-core@3.4.27/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7128:5)
  at _createVNode (node_modules/.pnpm/@vue+runtime-core@3.4.27/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7205:10)
  at Module.createVNodeWithArgsTransform (node_modules/.pnpm/@vue+runtime-core@3.4.27/node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:7083:10)
  at _sfc_ssrRender (node_modules/.pnpm/@nuxt+ui@2.16.0_focus-trap@7.5.4_nuxt@3.11.2_@opentelemetry+api@1.8.0_@parcel+watcher@2.4.1_@_fv4tt6ap5ofvze44igakxxao7u/node_modules/@nuxt/ui/dist/runtime/components/layout/Card.vue:60:69)

 ERROR  [nuxt] [request error] [unhandled] [500] 
Invalid prisma.sysConfig.findFirst() invocation in
/opt/discussion/server/api/config.ts:4:1

  1 import fs from "fs";
  2 
  3 export default defineEventHandler(async (event) => {
→ 4   const config = await prisma.sysConfig.findFirst(
The table public.SysConfig does not exist in the current database.
  at In.handleRequestError (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:122:6877)  
  at In.handleAndLogRequestError (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:122:6211)  
  at In.request (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:122:5919)  
  at async l (./node_modules/.pnpm/@prisma+client@5.14.0_prisma@5.14.0/node_modules/@prisma/client/runtime/library.js:127:11167)  
  at Object.handler (./server/api/config.ts:4:1)  
  at async ./node_modules/h3/dist/index.mjs:1962:19  
  at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)  
  at async toNodeHandle (./node_modules/h3/dist/index.mjs:2249:7)  
  at async ufetch (./node_modules/unenv/runtime/fetch/index.mjs:9:17)  
  at async $fetchRaw2 (./node_modules/ofetch/dist/shared/ofetch.37386b05.mjs:222:26)

 ERROR  [nuxt] [request error] [unhandled] [500] Cannot read properties of undefined (reading 'fullPath')
  at _sfc_ssrRender (./layouts/default.vue:346:20)  
  at renderComponentSubTree (./node_modules/.pnpm/@vue+server-renderer@3.4.27_vue@3.4.27_typescript@5.4.5_/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:695:9)  
  at ./node_modules/.pnpm/@vue+server-renderer@3.4.27_vue@3.4.27_typescript@5.4.5_/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:639:25  
  at runNextTicks (node:internal/process/task_queues:60:5)  
  at process.processImmediate (node:internal/timers:447:9)  
  at process.callbackTrampoline (node:internal/async_hooks:128:17)  
  at async unrollBuffer$1 (./node_modules/.pnpm/@vue+server-renderer@3.4.27_vue@3.4.27_typescript@5.4.5_/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:882:16)  
  at async unrollBuffer$1 (./node_modules/.pnpm/@vue+server-renderer@3.4.27_vue@3.4.27_typescript@5.4.5_/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:887:16)  
  at async unrollBuffer$1 (./node_modules/.pnpm/@vue+server-renderer@3.4.27_vue@3.4.27_typescript@5.4.5_/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:887:16)  
  at async unrollBuffer$1 (./node_modules/.pnpm/@vue+server-renderer@3.4.27_vue@3.4.27_typescript@5.4.5_/node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:887:16)
lateautumn2 commented 1 month ago

https://discussion.mblog.club/post/pnxGEVMjoq6aHyXm78UL3mw 参考此贴中的回复

kingwrcy commented 1 month ago
  1. 执行pnpm i安装依赖包
  2. 执行npx prisma migrate dev同步数据库
  3. 执行pnpm dev本地启动项目.

按照这个顺序来操作,前面忘记了第二步,readme已经更新说明了.

tech1024 commented 1 month ago

谢谢,按照你的方法已经解决了。