简体   繁体   English

TypeError:无法读取未定义的属性(读取'forEach)

[英]TypeError: Cannot read properties of undefined (reading 'forEach)

无法弄清楚为什么会出现此错误

Your problem is that you are trying to loop though the data object which is not a array.您的问题是您正在尝试遍历不是数组的data对象。 You can only use the forEach() function on arrays.您只能在数组上使用forEach()函数。 In addition, the data object is undefined meaning that it does not exist.此外, data对象未定义意味着它不存在。

Since I can not see all of your code, please check out this question Cannot read property 'forEach' of undefined on how to fix the undefined data object.由于我看不到您的所有代码,请查看这个问题Cannot read property 'forEach' of undefined关于如何修复未定义的data对象。 If that still doesn't fix the problem, read up on the documentation for supertest .如果这仍然不能解决问题,请阅读supertest的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError:无法读取未定义的属性(读取“forEach”) - TypeError: Cannot read properties of undefined (reading 'forEach') TypeError: Cannot read properties of undefined (reading 'forEach') 如何解决这个问题? - TypeError: Cannot read properties of undefined (reading 'forEach') How to overcome this problem? 类型错误:无法读取未定义的属性(读取“路径”) - TypeError: Cannot read properties of undefined (reading 'path') TypeError:无法读取未定义的属性(读取'indexOf') - TypeError: Cannot read properties of undefined (reading 'indexOf') TypeError:无法读取未定义的属性(读取“命令”) - TypeError: Cannot read properties of undefined (reading 'commands') TypeError:无法读取未定义的属性(读取“最高”) - TypeError: Cannot read properties of undefined (reading ‘highest’) TypeError:无法读取未定义的属性(读取“findOne”) - TypeError: Cannot read properties of undefined (reading 'findOne') TypeError:无法读取未定义的属性(读取“发送”) - TypeError: Cannot read properties of undefined (reading 'send') TypeError:无法读取未定义的属性(读取“useParams”) - TypeError: Cannot read properties of undefined (reading 'useParams') TypeError:无法读取未定义的属性(读取“abc”) - TypeError: Cannot read properties of undefined (reading 'abc')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM