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

Problems with npkill and windows? Check this out #183

Closed zaldih closed 5 months ago

zaldih commented 5 months ago

The latest update (v0.12.1) the UI does not work properly on windows (check issues below) due to an oversight, for not testing thoroughly on this platform due to my short time available (lesson learned).

If this affects you, you can use the latest fully-functional version by running:

npx npkill@0.11.3

Due to the aforementioned lack of time it will take me a few weeks to work on this. If anyone would like to investigate these problems, that would be great.

Thank you for your understanding and sorry for the inconvenience.


Problems detected:

If you detect another problem you can report it by opening an issue.

TheMikeyRoss commented 5 months ago

Thank you @zaldih ,

I just want to point out that the latest version 0.12.1 technically works and deletes the node_modules as intended. It's just visual "UI" problems that makes it look broken on Windows.

zaldih commented 5 months ago

@TheMikeyRoss Thank you for the clarification. I will update the message.

Out of curiosity, do you know if the problem also occurs on other terminals than cmd?

TheMikeyRoss commented 5 months ago

I just tested it on hyper and the same exact issues happened (all of them)

zaldih commented 5 months ago

Status update: the commit that introduced these problems is 9b4e339 . Strange, I thought it was a controller problem ๐Ÿค” .

The problem is caused by the change from get-folder-size lib v2 to v4. v3 also has problems. Investigating why

zaldih commented 5 months ago

OK, I have located the problem.

The api changed and I didn't update the service. This reveals another bigger problem:

  1. The UI doesn't update until the size of a result is calculated, instead of also updating at the time it is found.

It's a good time to refactor and create a similar the get-folder-size method itself in workers to improve efficiency.

zaldih commented 5 months ago

It should be solved. Could someone check it with npx npkill@0.12.2-1?

TheMikeyRoss commented 5 months ago

@zaldih I just tested and it seems to solve all issues ๐Ÿ‘

Although one small note I noticed that seems to act different from when testing in a MacOS:

On Mac the "Space Saved" is updated after each pending task is done, and there's even a cool little green arrow that shows up when the Space Saved increases

zaldih commented 5 months ago

@TheMikeyRoss thank you very much for all the help.

I'll post the version with these changes then.

For the other thing you said, I've been looking at that problem but I've only managed to replicate it when the node_module size is less than 100mb (as the total value is rounded down if I remember correctly). I'll look into it with more time.

All the best!