当从gitee 上clone 项目时,前端的文件目录 npm i 安装包 后端的文件目录也要 npm i 安装包,
否则 启动时会报
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module 'cors'
Require stack:
- C:\Users\vfx\Documents\HBuilderProjects\projectpet\pet\new\pet-adopt-new\pet-adopt\server\app.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (C:\Users\vfx\Documents\HBuilderProjects\projectpet\pet\new\pet-adopt-new\pet-adopt\server\app.js:2:14)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\vfx\\Documents\\HBuilderProjects\\projectpet\\pet\\new\\pet-adopt-new\\pet-adopt\\server\\app.js'
]
}
错 如下: