我創建了一個以nodejs作為后端的小型html表單,但無法提交表單出現此錯誤
Error: Cannot find module 'html'
Require stack:
- D:\web\smallmongoproject\node_modules\express\lib\view.js
- D:\web\smallmongoproject\node_modules\express\lib\application.js
- D:\web\smallmongoproject\node_modules\express\lib\express.js
- D:\web\smallmongoproject\node_modules\express\index.js
- D:\web\smallmongoproject\app.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18)
at new View (D:\web\smallmongoproject\node_modules\express\lib\view.js:81:14)
at Function.render (D:\web\smallmongoproject\node_modules\express\lib\application.js:587:12)
at ServerResponse.render (D:\web\smallmongoproject\node_modules\express\lib\response.js:1039:7)
at D:\web\smallmongoproject\app.js:41:7
at Layer.handle [as handle_request] (D:\web\smallmongoproject\node_modules\express\lib\router\layer.js:95:5)
at next (D:\web\smallmongoproject\node_modules\express\lib\router\route.js:144:13)
提交表單后,它應該在 mongodb 中輸入資料并再次呈現相同的表單。但相反,我在提交表單后收到此錯誤,因此它僅是第一次呈現。
uj5u.com熱心網友回復:
嘗試npm i html在你的 shell 中運行。這應該安裝 html 模塊依賴項。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/525889.html
