最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - TypeError: Object doesn't support property or method 'entries' (IE11) - Stack Overflow

programmeradmin1浏览0评论

I have an app written in Aurelia which needs to run in IE11.

Until last week the app was running ok but now I get the following error in the console when I try running it

TypeError: Object doesn't support property or method 'entries'

I have no idea what's caused this. I've gone back mits to a month ago, where the app was definitely working in IE11, but I get the same error.

We are using Yarn for package management with Webpack

The full stack dump is:

{
   [functions]: ,
   __proto__: { },
   __symbol:__symbol:rxSubscriber0.6484791277649529: undefined,
   __symbol:hasInstance0.64847912776495296: undefined,
   __symbol:isConcatSpreadable0.64847912776495297: undefined,
   __symbol:iterator0.64847912776495291: undefined,
   __symbol:match0.64847912776495292: undefined,
   __symbol:replace0.64847912776495293: undefined,
   __symbol:search0.64847912776495294: undefined,
   __symbol:species0.64847912776495299: undefined,
   __symbol:split0.64847912776495295: undefined,
   __symbol:toPrimitive0.648479127764952910: undefined,
   __symbol:toStringTag0.648479127764952911: undefined,
   __symbol:unscopables0.64847912776495298: undefined,
   description: "Object doesn't support property or method 'entries'",
   message: "Object doesn't support property or method 'entries'",
   name: "TypeError",
   number: -2146827850,
   stack: "TypeError: Object doesn't support property or method 'entries'
   at createSelectors (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:28145:9)
   at target.prototype[] (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:28176:13)
   at bind (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:36702:7)
   at bind (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:38733:7)
   at automate (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:38678:5)
   at ready (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48132:7)
   at swap (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48161:5)
   at Anonymous function (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48682:9)
   at Anonymous function (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-2"
}

I've tried looking at other SOF posts but I haven't been able to find a clear answer on what I should do - can anyone help?

Edit:

I just installed this polyfill and ran Webpack and now I'm getting this error:

ERROR [app-router] SyntaxError: Syntax error
   "ERROR [app-router]"
   {
      [functions]: ,
      __proto__: { },
      __symbol:__symbol:rxSubscriber0.7605681080912143: undefined,
      __symbol:hasInstance0.76056810809121436: undefined,
      __symbol:isConcatSpreadable0.76056810809121437: undefined,
      __symbol:iterator0.76056810809121431: undefined,
      __symbol:match0.76056810809121432: undefined,
      __symbol:replace0.76056810809121433: undefined,
      __symbol:search0.76056810809121434: undefined,
      __symbol:species0.76056810809121439: undefined,
      __symbol:split0.76056810809121435: undefined,
      __symbol:toPrimitive0.760568108091214310: undefined,
      __symbol:toStringTag0.760568108091214311: undefined,
      __symbol:unscopables0.76056810809121438: undefined,
      description: "Syntax error",
      message: "Syntax error",
      name: "SyntaxError",
      number: -2146827286,
      stack: "SyntaxError: Syntax error
   at tryCatcher (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:6757:9)
   at Promise.prototype._settlePromiseFromHandler (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4779:9)
   at Promise.prototype._settlePromise (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4836:13)
   at Promise.prototype._settlePromise0 (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4881:5)
   at Promise.prototype._settlePromises (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4960:13)
   at Async.prototype._drainQueue (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1689:13)
   at Async.prototype._drainQueues (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1699:5)
   at drainQueues (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1573:9)
  "
   }

I have an app written in Aurelia which needs to run in IE11.

Until last week the app was running ok but now I get the following error in the console when I try running it

TypeError: Object doesn't support property or method 'entries'

I have no idea what's caused this. I've gone back mits to a month ago, where the app was definitely working in IE11, but I get the same error.

We are using Yarn for package management with Webpack

The full stack dump is:

{
   [functions]: ,
   __proto__: { },
   __symbol:__symbol:rxSubscriber0.6484791277649529: undefined,
   __symbol:hasInstance0.64847912776495296: undefined,
   __symbol:isConcatSpreadable0.64847912776495297: undefined,
   __symbol:iterator0.64847912776495291: undefined,
   __symbol:match0.64847912776495292: undefined,
   __symbol:replace0.64847912776495293: undefined,
   __symbol:search0.64847912776495294: undefined,
   __symbol:species0.64847912776495299: undefined,
   __symbol:split0.64847912776495295: undefined,
   __symbol:toPrimitive0.648479127764952910: undefined,
   __symbol:toStringTag0.648479127764952911: undefined,
   __symbol:unscopables0.64847912776495298: undefined,
   description: "Object doesn't support property or method 'entries'",
   message: "Object doesn't support property or method 'entries'",
   name: "TypeError",
   number: -2146827850,
   stack: "TypeError: Object doesn't support property or method 'entries'
   at createSelectors (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:28145:9)
   at target.prototype[] (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:28176:13)
   at bind (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:36702:7)
   at bind (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:38733:7)
   at automate (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:38678:5)
   at ready (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48132:7)
   at swap (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48161:5)
   at Anonymous function (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48682:9)
   at Anonymous function (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-2"
}

I've tried looking at other SOF posts but I haven't been able to find a clear answer on what I should do - can anyone help?

Edit:

I just installed this polyfill and ran Webpack and now I'm getting this error:

ERROR [app-router] SyntaxError: Syntax error
   "ERROR [app-router]"
   {
      [functions]: ,
      __proto__: { },
      __symbol:__symbol:rxSubscriber0.7605681080912143: undefined,
      __symbol:hasInstance0.76056810809121436: undefined,
      __symbol:isConcatSpreadable0.76056810809121437: undefined,
      __symbol:iterator0.76056810809121431: undefined,
      __symbol:match0.76056810809121432: undefined,
      __symbol:replace0.76056810809121433: undefined,
      __symbol:search0.76056810809121434: undefined,
      __symbol:species0.76056810809121439: undefined,
      __symbol:split0.76056810809121435: undefined,
      __symbol:toPrimitive0.760568108091214310: undefined,
      __symbol:toStringTag0.760568108091214311: undefined,
      __symbol:unscopables0.76056810809121438: undefined,
      description: "Syntax error",
      message: "Syntax error",
      name: "SyntaxError",
      number: -2146827286,
      stack: "SyntaxError: Syntax error
   at tryCatcher (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:6757:9)
   at Promise.prototype._settlePromiseFromHandler (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4779:9)
   at Promise.prototype._settlePromise (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4836:13)
   at Promise.prototype._settlePromise0 (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4881:5)
   at Promise.prototype._settlePromises (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4960:13)
   at Async.prototype._drainQueue (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1689:13)
   at Async.prototype._drainQueues (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1699:5)
   at drainQueues (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1573:9)
  "
   }
Share Improve this question edited Jul 28, 2018 at 17:30 Vinyl Warmth asked Jul 28, 2018 at 17:03 Vinyl WarmthVinyl Warmth 2,5175 gold badges30 silver badges58 bronze badges 10
  • 1 You need polyfill for Object.entries(). developer.mozilla/en-US/docs/Web/JavaScript/Reference/… – Ritwick Dey Commented Jul 28, 2018 at 17:10
  • 1 Did you search your code base for Object.entries? It could have been added recently. You would need a polyfill as mentioned above otherwise. Easier would be to just find it and replace with non ES6 js if you do not want to deal with the polyfill etc. – Akrion Commented Jul 28, 2018 at 17:25
  • @Akrion I've updated my post as I'm getting a different (similar) error after installing the polyfill. As I said I went back 1 month's mits where it was definitely working. I don't understand why this problem has surfaced all of a sudden. It's doing the same on other machines too. – Vinyl Warmth Commented Jul 28, 2018 at 17:33
  • @RitwickDey I've updated my original post – Vinyl Warmth Commented Jul 28, 2018 at 17:33
  • 1 @VinylWarmth yes lock the packages that allow latest, delete node_modules folder and run npm install. If nothing helps, start removing your modules selectively if you can, until you narrow down and nail the culprit. – Benny Halperin Commented Jul 28, 2018 at 19:59
 |  Show 5 more ments

1 Answer 1

Reset to default 5

As people have mentioned, the fix for this was to implement the following polyfill

if (!Object.entries)
        Object.entries = function (obj) {
            var ownProps = Object.keys(obj),
                i = ownProps.length,
                resArray = new Array(i); // preallocate the Array
            while (i--)
                resArray[i] = [ownProps[i], obj[ownProps[i]]];

            return resArray;
        };
发布评论

评论列表(0)

  1. 暂无评论