fb55 / domutils

Utilities for working with htmlparser2's DOM
https://domutils.js.org
BSD 2-Clause "Simplified" License
202 stars 56 forks source link

ext[key].bind is not a function #665

Closed billtlee closed 3 years ago

billtlee commented 3 years ago

Hi, I don't know if this is the right place to post this. But I am running into a strange issue all of a sudden when I try to start my react app that was working fine before and the only error I am getting it the following:

UnhandledPromiseRejectionWarning: TypeError: ext[key].bind is not a function clientv1_1 | at /home/node/node_modules/renderkid/node_modules/domutils/index.js:12:28 clientv1_1 | at Array.forEach () clientv1_1 | at /home/node/node_modules/renderkid/node_modules/domutils/index.js:11:19

I tried googling this error but not able to find any solution. Trying my luck here to see if anyone might have an idea. Thanks in advance!

fb55 commented 3 years ago

Looking through this repos issues should have led to some reports.

This is an issue of an old version. Please try updating.

billtlee commented 3 years ago

@fb55 Thanks for getting back. When you say old version, can you be a little more specific? I am pretty sure I am using the latest. This is happening in a docker image using 14-alpine and below are the npm package I am using which are pretty current:

"@antv/data-set": "^0.11.4",
"@craco/craco": "^5.6.4",
"@ethersproject/shims": "^5.1.0",
"@material-ui/core": "^4.10.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/pickers": "^3.2.10",
"@metamask/detect-provider": "^1.2.0",
"@stripe/react-stripe-js": "1.2.0",
"@stripe/stripe-js": "1.11.0",
"axios": "^0.19.2",
"bizcharts": "^4.0.3",
"chartist": "^0.10.1",
"cookie-parser": "^1.4.5",
"crypto-js": "^4.0.0",
"env-cmd": "10.1.0",
"ethers": "^5.1.4",
"history": "^4.9.0",
"libsodium-wrappers": "0.7.8",
"lodash": "^4.17.15",
"material-ui-confirm": "^2.1.1",
"perfect-scrollbar": "^1.4.0",
"qs": "^6.9.4",
"react": "^16.13.1",
"react-bootstrap-sweetalert": "^5.1.9",
"react-chartist": "0.14.3",
"react-csv": "^2.0.1",
"react-dom": "^16.13.1",
"react-dropzone": "^11.0.1",
"react-papaparse": "3.8.0",
"react-redux": "^7.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-select": "^3.0.8",
"react-star-rating-component": "^1.4.1",
"react-swipeable-views": "^0.13.9",
"react-virtualized": "9.22.2",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"shuffle-seed": "^1.1.6"
fb55 commented 3 years ago

Looks like this package is a sub-dependency of some package. That package might not use the latest version yet. You can try removing your package lock file and the node modules directory, and reinstalling everything. Also npm outdated will be useful.

billtlee commented 3 years ago

I already tried reinstalling everything from scratch, but that didn't help. What do you mean by npm outdated will be useful? Use older version of npm?

fb55 commented 3 years ago

npm outdated is a command you can use to find old packages.

billtlee commented 3 years ago

ah, ok thanks!

Tresky commented 3 years ago

I'm using Cheerio which has htmlparser2 (which has domutis) as a dependency. I've been getting this same error. I thought maybe it was an outdated dependency issue, I checked my yarn.lock file for what version of domutils was being resolved and it was the latest (2.7.0).

So, it seems like in some circumstance, this issue still arises in the latest version.

I was using the latest version of Cheerio (1.0.0.rc-10). To get this to work, I had to go all the way back to rc-3 which was resolving domutils 1.7.0.

[
        "TypeError: ext[key].bind is not a function",
        "    at /tmp/b913f18b-a20c-43e8-9185-c8e9ad3c4892/builder/node_modules/htmlparser2/node_modules/domutils/index.js:12:28",
        "    at Array.forEach (<anonymous>)",
        "    at /tmp/b913f18b-a20c-43e8-9185-c8e9ad3c4892/builder/node_modules/htmlparser2/node_modules/domutils/index.js:11:19",
        "    at Array.forEach (<anonymous>)",
        "    at Object.<anonymous> (/tmp/b913f18b-a20c-43e8-9185-c8e9ad3c4892/builder/node_modules/htmlparser2/node_modules/domutils/index.js:10:3)",
        "    at Module._compile (internal/modules/cjs/loader.js:1085:14)",
        "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
        "    at Module.load (internal/modules/cjs/loader.js:950:32)",
        "    at Function.Module._load (internal/modules/cjs/loader.js:790:14)",
        "    at Module.require (internal/modules/cjs/loader.js:974:19)"
    ]

Maybe it makes more sense to post this in Cheerio or htmlparser2 repos? I wasn't sure, so I went to this issue because it was mentioned at the top that it shouldn't be happening anymore in the latest version of domutils.