简体   繁体   English

如何修复 - 未处理的拒绝(类型错误)。 Promise.allSettled 不是函数

[英]How to fix - Unhandled Rejection (TypeError). Promise.allSettled is not a function

Photo Photo照片照片

I have these errors only on some phones when I am testing the mobile functionality.当我测试移动功能时,我只在某些手机上出现这些错误。 If someone has any idea how to fix it... My node version is 14.10.0 as I understood could be from there, since Promise.allSettled is were handled above version 12.9.如果有人知道如何修复它......我的节点版本是 14.10.0,据我所知可能来自那里,因为 Promise.allSettled 是在 12.9 以上版本处理的。 When I check the node --version, it is 14.10.0, but my nodejs --version is 10.19.0.当我检查节点 --version 时,它是 14.10.0,但我的 nodejs --version 是 10.19.0。 The phone is Samsung A3 with android version 8. On huawei Y5 android version 9, there are not any errors, as well on any iPhone, which I have checked so far.手机是三星 A3,安卓版本 8。在华为 Y5 安卓版本 9 上,没有任何错误,在任何 iPhone 上也是如此,到目前为止我已经检查过。

allSettled is quite a new addition to Promise , so you're just dealing with slightly out-of-date environments. allSettledPromise一个新成员,因此您只是在处理稍微过时的环境。 You'll need to polyfill it in the environments where it doesn't exist.您需要在它不存在的环境中对它进行 polyfill。 Your best bet is to locate a well-maintained polyfill library and use that.最好的办法是找到一个维护良好的 polyfill 库并使用它。 (One library is core.js . There was some drama around the availability of the project's originator, but I think that's largely worked out now.) (一个库是core.js 。关于该项目发起者的可用性有一些戏剧性,但我认为现在基本上已经解决了。)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM