voidcosmos / npkill

List any node_modules 📦 dir in your system and how heavy they are. You can then select which ones you want to erase to free up space 🧹
https://npkill.js.org
MIT License
8.31k stars 188 forks source link

Invalid count value #157

Closed andromidasj closed 1 year ago

andromidasj commented 1 year ago

Describe the bug Whenever running npx npkill, with or without option flags, I get an Invalid count value error. Using the arrow keys to select 'up' or 'down', the error count increments, and upon inspecting the errors by hitting e, they are all the same error: RangeError: Invalid count value on the 0th index, and Invalid count value on the rest. (See screenshot below.)

At this point, everything is broken and unresponsive, and needs to be cancelled with CTRL+C. This is reproducible for me on three different terminals: macOS Terminal, Tabby, and Warp.

To Reproduce Steps to reproduce the behavior:

  1. Running npx npkill
  2. Wait for scanning, and when the progress bar is about 2/3 the way through, it'll show a message at the top 1 error. 'e' to see

Expected behavior I expect the utility to run without errors.

Screenshots

image image

Additional context This happens with or without flags (-x, -s size, etc). While troubleshooting, and on my first try with the built-in macOS terminal, it actually performed a successful run-through. I then decided to add the flags above, and then got the same error. When trying again without any flags, I could not reproduce a successful run-through again, and it would fail every time.

andromidasj commented 1 year ago

Update: My first run-through of npx npkill (with no flags) on iTerm worked without a problem. I deleted a couple of folders presumably successfully, but then when I resized the screen all the options disappeared (guess that's on me?), but then I'd get the same errors as the original post.

I hit CTRL+C, ran npx npkill one more time, and now it fails just like the other ones.

andromidasj commented 1 year ago

One more troubleshooting update: looks like a single repository was causing npkill to crash. When I excluded a specific repo using the -E flag, it reliably works now! The repo in question was a cloned repo from https://github.com/sct/overseerr. Not sure why it broke npkill though.

zaldih commented 1 year ago

Thank you very much for opening the issue with all the details!

It seems that the same problem is described the issue #149 . I just released version 0.11.3 which should fix the problem, could you check it?

zaldih commented 1 year ago

Closing as resolved. If the problem persists feel free to reopen it.

mortalYoung commented 1 year ago

I got this problem in v0.11.3. I have no idea about what happened.

image
mortalYoung commented 1 year ago

I found once I removed the node_modules under ./apps/myProject/(my project is based on turbo), It would work again! Would you mind tell me the reason so I could prevent it happened again?