amio/npm-why

Maximum call stack size exceeded

OmgImAlexis opened this issue · 4 comments

I cloned https://github.com/pelotom/runtypes, deleted the yarn.lock, ran npm i and then npm-why ws.

➜  runtypes git:(master) ✗ npm-why ws
(node:47582) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
    at buildDependentsTree (/Users/xo/.nvm/versions/node/v14.15.0/lib/node_modules/npm-why/index.js:51:30)
    at /Users/xo/.nvm/versions/node/v14.15.0/lib/node_modules/npm-why/index.js:67:12
    at Array.map (<anonymous>)
    at buildDependentsTree (/Users/xo/.nvm/versions/node/v14.15.0/lib/node_modules/npm-why/index.js:65:42)
    at /Users/xo/.nvm/versions/node/v14.15.0/lib/node_modules/npm-why/index.js:67:12
    at Array.map (<anonymous>)
    at buildDependentsTree (/Users/xo/.nvm/versions/node/v14.15.0/lib/node_modules/npm-why/index.js:65:42)
    at /Users/xo/.nvm/versions/node/v14.15.0/lib/node_modules/npm-why/index.js:67:12
    at Array.map (<anonymous>)
    at buildDependentsTree (/Users/xo/.nvm/versions/node/v14.15.0/lib/node_modules/npm-why/index.js:65:42)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:47582) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:47582) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Running the same test with the yarn.lock and yarn-why produces this.

➜  runtypes git:(master) npx yarn-why ws
npx: installed 4 in 3.266s

  Who required ws:

  runtypes > jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > ws@^7.4.4
  runtypes > jest > @jest/core > jest-runner > jest-config > jest-environment-jsdom > jsdom > ws@^7.4.4
  runtypes > jest > @jest/core > jest-runner > jest-runtime > jest-config > jest-environment-jsdom > jsdom > ws@^7.4.4
  runtypes > jest > @jest/core > jest-runtime > jest-config > jest-environment-jsdom > jsdom > ws@^7.4.4
  runtypes > jest > jest-cli > @jest/core > jest-config > jest-environment-jsdom > jsdom > ws@^7.4.4
  runtypes > jest > jest-cli > @jest/core > jest-runner > jest-config > jest-environment-jsdom > jsdom > ws@^7.4.4
  runtypes > jest > jest-cli > @jest/core > jest-runner > jest-runtime > jest-config > jest-environment-jsdom > jsdom > ws@^7.4.4
  runtypes > jest > jest-cli > @jest/core > jest-runtime > jest-config > jest-environment-jsdom > jsdom > ws@^7.4.4
  runtypes > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > ws@^7.4.4

Same problem. I have a React progressive web app with the following top-level packages, according to "npm ls --depth=0"

├── @testing-library/jest-dom@5.14.1
├── @testing-library/react@11.2.7
├── @testing-library/user-event@12.8.3
├── bootstrap@5.0.2
├── react-dom@17.0.2
├── react-router-dom@5.2.0
├── react-scripts@4.0.3
├── react@17.0.2
├── web-vitals@0.2.4
├── workbox-background-sync@5.1.4
├── workbox-broadcast-update@5.1.4
├── workbox-cacheable-response@5.1.4
├── workbox-core@5.1.4
├── workbox-expiration@5.1.4
├── workbox-google-analytics@5.1.4
├── workbox-navigation-preload@5.1.4
├── workbox-precaching@5.1.4
├── workbox-range-requests@5.1.4
├── workbox-routing@5.1.4
├── workbox-strategies@5.1.4
└── workbox-streams@5.1.4

When I run "npm-why tough-cookie" I get

riesbeck@Chriss-MacBook-Pro nysl-app % npm-why tough-cookie
(node:22589) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
    at buildDependentsTree (/Users/riesbeck/.nvm/versions/node/v14.17.0/lib/node_modules/npm-why/index.js:51:30)
    at /Users/riesbeck/.nvm/versions/node/v14.17.0/lib/node_modules/npm-why/index.js:67:12
    at Array.map (<anonymous>)
    at buildDependentsTree (/Users/riesbeck/.nvm/versions/node/v14.17.0/lib/node_modules/npm-why/index.js:65:42)
    at /Users/riesbeck/.nvm/versions/node/v14.17.0/lib/node_modules/npm-why/index.js:67:12
    at Array.map (<anonymous>)
    at buildDependentsTree (/Users/riesbeck/.nvm/versions/node/v14.17.0/lib/node_modules/npm-why/index.js:65:42)
    at /Users/riesbeck/.nvm/versions/node/v14.17.0/lib/node_modules/npm-why/index.js:67:12
    at Array.map (<anonymous>)
    at buildDependentsTree (/Users/riesbeck/.nvm/versions/node/v14.17.0/lib/node_modules/npm-why/index.js:65:42)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:22589) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:22589) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Same happened to me trying to figure out why react-native is being installed into my web project.

I'm quite sure that this issue is resolved by the merging of #349. Perhaps @amio could close it, and reopen if it reoccurs?