Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Error: spawn useradd ENOENT #778

Closed
zhaoyiming0803 opened this issue Jan 4, 2022 · 4 comments
Closed

Error: spawn useradd ENOENT #778

zhaoyiming0803 opened this issue Jan 4, 2022 · 4 comments

Comments

@zhaoyiming0803
Copy link

Reference http://ldapjs.org/guide.html to add user, but command report error:

/etc/passwd LDAP server up at: ldap://0.0.0.0:1389
node:events:368
      throw er; // Unhandled 'error' event
      ^

Error: spawn useradd ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn useradd',
  path: 'useradd',
  spawnargs: [ '-m', '-c', 'Created via ldapadd', '-s', '/bin/bash', 'ldapjs' ]
}

node version: v16.13.1

npm version: 8.1.2

@jsumners
Copy link
Member

jsumners commented Jan 4, 2022

Please provide a minimal reproduction.

@zhaoyiming0803
Copy link
Author

Please provide a minimal reproduction.

test repository: https://github.com/zhaoyiming0803/test-ldap

npm  ci

npm run dev

@jsumners
Copy link
Member

I'm sorry. It isn't clear what I should be doing with that example. It starts a server and nothing else. But it looks like you are using child_process to spawn an external command, and that is what is generating the error. The error you posted originally is stating that the useradd binary does not exist. Your spawn call should include an environment where the useradd binary is in the PATH.

@jsumners
Copy link
Member

👋

On February 22, 2023, we released version 3 of this library. As a result, we are closing this issue/pull request.

Please see issue #839 for more information, including how to proceed if you feel this closure is in error.

@ldapjs ldapjs locked as resolved and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants