當(dāng)我在nodejs中運(yùn)行node server.js時(shí),錯(cuò)誤消息顯示“無(wú)法讀取未定義的屬性‘長(zhǎng)度’”。我已經(jīng)安裝了所有相關(guān)的庫(kù)(例如請(qǐng)求)并查看了不同的相關(guān)帖子。然而,問題仍然存在。我認(rèn)為這與快遞或索引文件有關(guān)。有什么建議嗎?非常感謝!(node:14320) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefinedat pathtoRegexp (/home/floyd/Desktop/icigai/marketplace_backend/node_modules/path-to-regexp/index.js:63:49)at new Layer (/home/floyd/Desktop/icigai/marketplace_backend/node_modules/express/lib/router/layer.js:45:17)at Function.use (/home/floyd/Desktop/icigai/marketplace_backend/node_modules/express/lib/router/index.js:464:17)at Function.<anonymous> (/home/floyd/Desktop/icigai/marketplace_backend/node_modules/express/lib/application.js:220:21)at Array.forEach (<anonymous>)at Function.use (/home/floyd/Desktop/icigai/marketplace_backend/node_modules/express/lib/application.js:217:7)at _default (/home/floyd/Desktop/icigai/marketplace_backend/src/loaders/express.js:28:9)at _callee$ (/home/floyd/Desktop/icigai/marketplace_backend/src/loaders/index.js:8:11)at tryCatch (/home/floyd/Desktop/icigai/marketplace_backend/node_modules/regenerator-runtime/runtime.js:63:40)at Generator.invoke [as _invoke] (/home/floyd/Desktop/icigai/marketplace_backend/node_modules/regenerator-runtime/runtime.js:293:22)(node:14320) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
Nodejs 中出現(xiàn)類型錯(cuò)誤的 UnhandledPromiseRejectionWarning
慕容708150
2023-12-14 14:08:22