如何解决“未捕获类型错误:iterable.hasOwnProperty 不是函数”?
我正在尝试在代码中使用 react-leaflet-markerclusters
包。但是,在安装并运行 npm start
后,我收到此错误 (
loadMessages.js?4a62:4 Uncaught TypeError: iterable.hasOwnProperty is not a function
at traverse (loadMessages.js?4a62:4:1)
at loadMessages (loadMessages.js?4a62:25:1)
at eval (Root.js?e933:41:13)
at Module../src/masterApp/components/app/Root.js (bundle.js:49970:1)
at __webpack_require__ (bundle.js:790:30)
at fn (bundle.js:101:20)
at eval (index.js?b635:1:1)
at Module../src/index.js (bundle.js:49802:1)
at __webpack_require__ (bundle.js:790:30)
at fn (bundle.js:101:20)
) 和白屏。
我在应用程序中对 hasOwnProperty
进行了全局搜索,但没有结果。我假设这与外部包相关。经过进一步挖掘,它似乎与我在 Root.js
中导入的 loadMessages
相关。
以下是 Root.js
的片段:
import "core-js/stable";
import "regenerator-runtime/runtime";
import React from "react";
...
import { loadMessages, LocalizationProvider } from "@progress/kendo-react-intl";
import messages from "../../../assets/messages/messages";
loadMessages(messages.ar, "ar");
loadMessages(messages.en, "en");
loadMessages(messages.es, "es");
loadMessages(messages.fr, "fr");
我已尝试将 @progress/kendo-react-intl
更新到最新版本,但仍然收到 TypeError。 loadMessages 前面需要前缀吗?
如果有帮助,请注意我使用的是 Node 14.4.0 和 babel 7。更新此版本以上的 Node 会导致 Node-sass 错误。我应该降级 babel 吗?
I am trying to use the react-leaflet-markerclusters
package in my code. However after installing it and running npm start
, I am getting this error (
loadMessages.js?4a62:4 Uncaught TypeError: iterable.hasOwnProperty is not a function
at traverse (loadMessages.js?4a62:4:1)
at loadMessages (loadMessages.js?4a62:25:1)
at eval (Root.js?e933:41:13)
at Module../src/masterApp/components/app/Root.js (bundle.js:49970:1)
at __webpack_require__ (bundle.js:790:30)
at fn (bundle.js:101:20)
at eval (index.js?b635:1:1)
at Module../src/index.js (bundle.js:49802:1)
at __webpack_require__ (bundle.js:790:30)
at fn (bundle.js:101:20)
) and a white screen.
I did a global search in my application for hasOwnProperty
and there are no results. I'm assuming this is tied to an external package. After further digging, it seems like it is tied to my loadMessages
import in Root.js
.
Here's a snippet of Root.js
:
import "core-js/stable";
import "regenerator-runtime/runtime";
import React from "react";
...
import { loadMessages, LocalizationProvider } from "@progress/kendo-react-intl";
import messages from "../../../assets/messages/messages";
loadMessages(messages.ar, "ar");
loadMessages(messages.en, "en");
loadMessages(messages.es, "es");
loadMessages(messages.fr, "fr");
I've tried updating @progress/kendo-react-intl
to the latest version but I still get the TypeError. Do I need a prefix in front of loadMessages?
If it helps any, please note that I am using node 14.4.0 and babel 7. Updating node beyond this version causes a node-sass error. Should I downgrade babel?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我必须改变:
成为:
I had to change:
To be: