我创建了一个以nodesjs为后端的小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并再次呈现相同的表单。但是相反,我在提交表单后得到了这个错误,所以它只是第一次呈现。
发布于 2022-11-02 19:04:33
尝试在您的shell中运行npm i html。这应该安装html模块依赖项。
https://stackoverflow.com/questions/74294356
复制相似问题