kill-port-process icon indicating copy to clipboard operation
kill-port-process copied to clipboard

dest.end is not a function

Open femiveys opened this issue 4 years ago • 13 comments

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

femiveys avatar Dec 29 '20 11:12 femiveys

Hi @femiveys ,

Thanks for opening this issue and sorry for the problem you are experiencing.

What platform are you on? Window, Mac or Linux?

hilleer avatar Dec 29 '20 12:12 hilleer

I am on OSX Catalina 10.15.7

femiveys avatar Dec 29 '20 13:12 femiveys

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.

hilleer avatar Feb 01 '21 19:02 hilleer

@femiveys I am closing this one until further information is provided.

hilleer avatar Mar 03 '21 08:03 hilleer

I think you don't have lsof command installed on your machine.

ofergoli avatar Nov 14 '22 12:11 ofergoli

Running into the same issue on macOS Sonoma 14.0, lsof is installed through brew.

alkanna avatar Aug 22 '23 19:08 alkanna

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.

ape-dev-cs avatar Dec 09 '23 21:12 ape-dev-cs

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 🙂

hilleer avatar Dec 12 '23 08:12 hilleer

@ape-dev-cs what specific node (18) version are you running to reproduce this? 🙂

hilleer avatar Dec 22 '23 15:12 hilleer

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?

hilleer avatar Dec 22 '23 15:12 hilleer

I get the same error using the beta. I'm on osx Monterey.

TheNextGuy32 avatar Feb 17 '24 04:02 TheNextGuy32

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?

hilleer avatar Feb 17 '24 14:02 hilleer

18.14.2

TheNextGuy32 avatar Feb 21 '24 00:02 TheNextGuy32