[英]files.forEach((file) => { TypeError: Cannot read properties of undefined (reading 'forEach')
I already search solutions for this problem but all I can find is "missing semi colon" which is obviously not my problem... Here are the code and its error我已经搜索了这个问题的解决方案,但我能找到的只是“缺少分号”,这显然不是我的问题......这是代码及其错误
Node.JS MongoDB File-Upload Node.JS MongoDB 文件上传
Can anyone help me?谁能帮我?
I already search solutions for this problem but all I can find is "missing semi colon" which is obviously not my problem我已经搜索了这个问题的解决方案,但我能找到的只是“缺少分号”,这显然不是我的问题
Use fs.readdirSync
in line 41 instead.请改用第 41 行中的
fs.readdirSync
。
Based on the error log you provided, the files
Is not defined.根据您提供的错误日志,
files
未定义。 Add a guard clause at line 47 to check field exist before running the code在第 47 行添加一个 guard 子句以在运行代码之前检查字段是否存在
if (files && files.length >0){
//original line 47-52
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.