kill-port-process
                                
                                 kill-port-process copied to clipboard
                                
                                    kill-port-process copied to clipboard
                            
                            
                            
                        dest.end is not a function
I used to use the kill-port module for this functionality but it didn't have types for TypeScript, so I switched to this module. However, now I get an ugly error:
dest.end is not a function
This is my simplified code:
import { killPortProcess } from 'kill-port-process';
export const startApiServer = async () => {
  await killPortProcess(8000);
  ...
}
...
startApiServer()
This makes this module unusable for me.
I have tried it with node 10 and 12
Hi @femiveys ,
Thanks for opening this issue and sorry for the problem you are experiencing.
What platform are you on? Window, Mac or Linux?
I am on OSX Catalina 10.15.7
Hi @femiveys ,
I am sorry about the lack of action and late response here. I'm not able to reproduce this. Can you share some more information on how you execute this code? Is it typescript compiled? Optimally it would be nice if you can share an online repo or something like that where it is reproducible.
@femiveys I am closing this one until further information is provided.
I think you don't have lsof command installed on your machine.
Running into the same issue on macOS Sonoma 14.0, lsof is installed through brew.
I can reproduce this on Arch Linux. I can confirm that I have every executable installed & on PATH which is mentioned in the source code.
The full output that I see in my terminal is as follows:
TypeError: dest.end is not a function
 ❯ Socket.onend node:internal/streams/readable:705:10
 ❯ Object.onceWrapper node:events:628:28
 ❯ Socket.emit node:events:526:35
 ❯ endReadableNT node:internal/streams/readable:1359:12
 ❯ processTicksAndRejections node:internal/process/task_queues:82:21
However grepping for "dest.end" in my node_modules folder doesn't yield any results relevant to this module. Interestingly, I only get this error when invoking killPortProcess from inside a beforeAll in a vitest test. Invoking it normally in a TypeScript file doesn't reproduce it.
I'm running Node 18.
I can confirm that we get to Line 69 here and everything's fine: https://github.com/hilleer/kill-port-process/blob/main/src/lib/killer.ts#L69
However, the xargs.on listener on line 70 never fires, and we get the error shown above.
Hi @ape-dev-cs
Thanks for the well described comment! I will have a look into it at some point. Meanwhile, if you're interested, feel free to have one too and open a PR if you find a fix 🙂
@ape-dev-cs what specific node (18) version are you running to reproduce this? 🙂
Hi all
I have published a v4 beta. Would it be possible for you to try this one and see if it resolves your problem?
I get the same error using the beta. I'm on osx Monterey.
I get the same error using the beta. I'm on osx Monterey.
@TheNextGuy32 thanks for getting back to me here. Can you share also what node version you're using?
18.14.2