I've had a number of freezes after an npm i that, even if I scorch the node_modules folder & npm cache (rmdir /S /Q node_modules and then npm cache clean --force), can still happen and that don't seem to happen at predictable times.
Here's one possible answer from the nodejs project's github issues pages, edited slightly to match what I see now in Win10:
though note that you don't have to actively highlight anything for it to stop; I think that's a red herring (or the install is "highlighting" something)
This "Randomly" hang issue is causing by CMD when you trying to
highlight inside of CMD. To resolve this issue:
- right click title bar
- select Defaults
- unselect Quick Edit Mode from the Options tab
- reopen CMD
I've given that a try with some success. I think the downside is limited to you having have to hit Alt-space, e, k to select text with the mouse like you did before Quick Edit Mode.