DylanPiercey / local-devices

🔮 Find devices connected to the current local network.
MIT License
139 stars 27 forks source link

App crashes after a while: `Error: Command failed: arp -a` #62

Closed Creative-Difficulty closed 2 years ago

Creative-Difficulty commented 2 years ago

After about 40 seconds of not being in VSCode I get this error:

node:internal/errors:856
  const err = new Error(message);
              ^

Error: Command failed: arp -a

    at ChildProcess.exithandler (node:child_process:389:12)
    at ChildProcess.emit (node:events:537:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: null,
  killed: true,
  signal: 'SIGTERM',
  cmd: 'arp -a'
}

Node.js v18.5.0

OS: macOS Monterey, MacBook Air 2017 Node Version: v18.5.0

Any help would be greatly appreciated, since this project is very important! Reagards, Alex

Creative-Difficulty commented 2 years ago

Hello?? @DylanPiercey ?? Anyone here?? This is a serious issue in my software, which is soon going into production!!!

DylanPiercey commented 2 years ago

Please create a reproduction, or a PR. It's likely that this issue has nothing to do with this module.

Creative-Difficulty commented 2 years ago

I just wrote an alternative in 40 lines of code. Running arp -a DOES work. This issue is with your module. Its very slow btw. (With local-devices my apps startup-time was 10-15s, now its 2-5s). BRUH

DylanPiercey commented 2 years ago

Awesome! PR's welcome!

DylanPiercey commented 2 years ago

Also jsyk this module does use arp -a. The reason it's slower is because it ensures the arp table is populated via pings. I believe using arp -a alone will not give you complete results. However if that works for your use case then great!

https://stackoverflow.com/a/53233072

jungalwala commented 1 year ago

I am getting a very similar error. It was working great for me and then suddenly it stopped working. `{ status: 'fail', data: Error: Command failed: arp -a

  at ChildProcess.exithandler (node:child_process:412:12)
  at ChildProcess.emit (node:events:513:28)
  at maybeClose (node:internal/child_process:1091:16)
  at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

{ code: null, killed: true, signal: 'SIGTERM', cmd: 'arp -a' } }`

On a macbook (OS 13.1 (22C65))

jungalwala commented 1 year ago

I found my own solution, so my desktop's arp table had tons of ips that are no longer used. Once I did a sudo arp -d -a that cleared my arp table and this module started working great.