目前正在将我的项目从 JS 转换为 TS,在服务器端工作。这是错误代码。
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module
'/Users/steven/Documents/codingDojo/Mern/tomrotten/server/index.js'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain]
(internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
[nodemon] app crashed - waiting for file changes before starting...
这是我的依赖项列表:
"dependencies": {
"@material-ui/lab": "^4.0.0-alpha.58",
"bcryptjs": "^2.4.3",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-session": "^1.17.1",
"jsonwebtoken": "^8.5.1",
"mysql": "^2.18.1",
"mysql2": "^2.2.5",
"sequelize": "^6.5.0",
"sqlite3": "^5.0.1"
答案 0 :(得分:0)
发生这种情况是因为它缺少一个依赖项,要么是因为该依赖项未导入,要么是导入但未安装。在 import cjr from "cjr"
的顶部有 server/index.js
或类似的东西吗?你做了npm install
吗?